From c670bf843f4d6546b239993f934b467165391128 Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Sat, 19 Aug 2023 11:31:27 -0700 Subject: [PATCH] Various updates --- fnl/macros.fnl | 11 +++-------- fnl/plugin.fnl | 7 ++++--- fnl/plugin/lsp.fnl | 15 +++++++++++++-- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/fnl/macros.fnl b/fnl/macros.fnl index 6059e56..9400323 100644 --- a/fnl/macros.fnl +++ b/fnl/macros.fnl @@ -88,7 +88,8 @@ `(use ,output)) ;; Call a plugin's `setup function' -(lambda setup! [pkg ...] (local output [ ]) +(lambda setup! [pkg ...] + (local output [ ]) (var last_key nil) (each [_ val (ipairs [...])] (if last_key @@ -116,16 +117,10 @@ `(let [save# (vim.fn.winsaveview)] ,(unpack args)))) -;; Returns the keys for table -;; Careful, this finds them will a loop every time it is called! -(lambda keys! [table] - `(icollect [key# _# (pairs ,table)] key#)) - {: bind! : hook! : use! : setup! : module-call! : module-fn! - : save-excursion! - : keys!} + : save-excursion!} diff --git a/fnl/plugin.fnl b/fnl/plugin.fnl index 0fb0c9e..58dceb6 100644 --- a/fnl/plugin.fnl +++ b/fnl/plugin.fnl @@ -85,6 +85,7 @@ :TroubleToggle :TroubleClose :TroubleRefresh ] + :module :trouble :config (setup! :trouble)) @@ -176,9 +177,9 @@ ; oil (file manager) (use! :stevearc/oil.nvim - :config + :confi (setup! :oil - :columns { :icon :permissions :size: :mtime })) + :columns [ :icon :permissions :size: :mtime ])) ;; guess style from buffer (use! :NMAC427/guess-indent.nvim @@ -211,7 +212,7 @@ ; :config ; (setup! :formatter ; :logging true - ; :log_level _G.vim.log.levels.WARN + ; :log_level _G.vim.log.levels.WA;RN ; :filetype { ; :c [ (module-fn! :formatter.filetypes.c :astyle) ] ; :cpp [ (module-fn! :formatter.filetypes.cpp :astyle) ] diff --git a/fnl/plugin/lsp.fnl b/fnl/plugin/lsp.fnl index 53153c3..03b3f8b 100644 --- a/fnl/plugin/lsp.fnl +++ b/fnl/plugin/lsp.fnl @@ -44,10 +44,21 @@ (bind! :n :gd "Telescope lsp_definitions" buf) (bind! :n :gI "Telescope lsp_implementations" buf) (bind! :n :D "Telescope lsp_type_definitions" buf) + (bind! :n :fq "Telescope diagnostics" buf) ;; Some trouble commands - (bind! :n :q "TroubleToggle document_diagnostics") - (bind! :n :Q "TroubleToggle workspace_diagnostics")) + (bind! :n :q (fn [] + (let [trouble (require :trouble)] + (if (trouble.is_open) + (trouble.close) + true + (trouble.open :document_diagnostics))))) + (bind! :n :Q (fn [] + (let [trouble (require :trouble)] + (if (trouble.is_open) + (trouble.close) + true + (trouble.open :workspace_diagnostics)))))) (fn get-data-dir [server root] (let [resolved_path (vim.fn.resolve root)