From b510c78da86c6b30b95039cc31d5a3267ee7e395 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Wed, 28 Sep 2022 01:15:03 +0200 Subject: Add Trouble plugin --- fnl/config/init.fnl | 1 + fnl/config/trouble.fnl | 82 ++++++++++++++++++++++++++++++++++++++++++++++++ fnl/config/which-key.fnl | 1 + 3 files changed, 84 insertions(+) create mode 100644 fnl/config/trouble.fnl (limited to 'fnl/config') diff --git a/fnl/config/init.fnl b/fnl/config/init.fnl index 2d41bff..1cf6001 100644 --- a/fnl/config/init.fnl +++ b/fnl/config/init.fnl @@ -31,6 +31,7 @@ config.toggleterm config.treesitter config.trim + config.trouble config.vim-slash config.which-key config.window-picker diff --git a/fnl/config/trouble.fnl b/fnl/config/trouble.fnl new file mode 100644 index 0000000..03942af --- /dev/null +++ b/fnl/config/trouble.fnl @@ -0,0 +1,82 @@ +;; Pretty diagnostics. +(module config.trouble {autoload {: util}}) + +(def- opts {:position :bottom + ;; position of the list can be: bottom, top, left, right + :height 10 + ;; height of the trouble list when position is top or bottom + :width 50 + ;; width of the list when position is left or right + :icons true + ;; use devicons for filenames + :mode :workspace_diagnostics + ;; "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist" + :fold_open "" + ;; icon used for open folds + :fold_closed "" + ;; icon used for closed folds + :group true + ;; group results by file + :padding true + ;; add an extra new line on top of the list + :action_keys {;; key mappings for actions in the trouble list + ;; map to {} to remove a mapping for example: + ;; close {} + :close :q + ;; close the list + :cancel : + ;; cancel the preview and get back to your last window / buffer / cursor + :refresh :r + ;; manually refresh + :jump [: :] + ;; jump to the diagnostic or open / close folds + :open_split [:] + ;; open buffer in new split + :open_vsplit [:] + ;; open buffer in new vsplit + :open_tab [:] + ;; open buffer in new tab + :jump_close [:o] + ;; jump to the diagnostic and close the list + :toggle_mode :m + ;; toggle between "workspace" and "document" diagnostics mode + :toggle_preview :P + ;; toggle auto_preview + :hover :K + ;; opens a small popup with the full multiline message + :preview :p + ;; preview the diagnostic location + :close_folds [:zM :zm] + ;; close all folds + :open_folds [:zR :zr] + ;; open all folds + :toggle_fold [:zA :za] + ;; toggle fold of current file + :previous :k + ;; previous item + :next :j + ;; next item + } + :indent_lines true + ;; add an indent guide below the fold icons + :auto_open false + ;; automatically open the list when you have diagnostics + :auto_close false + ;; automatically close the list when you have no diagnostics + :auto_preview true + ;; automatically preview the location of the diagnostic. to close preview and go back to last window + :auto_fold false + ;; automatically fold a file trouble list at creation + :auto_jump [:lsp_definitions] + ;; for the given modes, automatically jump if there is only a single result + :signs {;; icons / text used for a diagnostic + :error "" + :warning "" + :hint "" + :information "" + :other "﫠"} + :use_diagnostic_signs false + ;; enabling this will use the signs defined in your lsp client + }) + +(util.use-config :trouble opts) diff --git a/fnl/config/which-key.fnl b/fnl/config/which-key.fnl index b5eb319..5cba39c 100644 --- a/fnl/config/which-key.fnl +++ b/fnl/config/which-key.fnl @@ -39,6 +39,7 @@ :Harpoon] :b ["lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{sort_lastused = true, initial_mode = 'normal', previewer = false})" "Switch buffers"] + :d [:TroubleToggle :Trouble] :f ["lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})" "Find files"] :g ["Telescope live_grep theme=ivy" "Find text"] -- cgit v1.2.3-70-g09d2