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)