summaryrefslogtreecommitdiff
path: root/fnl/config
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-09-28 01:15:03 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-09-28 01:15:03 +0200
commitb510c78da86c6b30b95039cc31d5a3267ee7e395 (patch)
tree76bb8cc09c1faabb2b06b3b32444735855f5346d /fnl/config
parent4c5f771c8423de432ac02d0092f5ea2754d189ce (diff)
Add Trouble plugin
Diffstat (limited to 'fnl/config')
-rw-r--r--fnl/config/init.fnl1
-rw-r--r--fnl/config/trouble.fnl82
-rw-r--r--fnl/config/which-key.fnl1
3 files changed, 84 insertions, 0 deletions
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 :<esc>
+ ;; cancel the preview and get back to your last window / buffer / cursor
+ :refresh :r
+ ;; manually refresh
+ :jump [:<cr> :<tab>]
+ ;; jump to the diagnostic or open / close folds
+ :open_split [:<c-x>]
+ ;; open buffer in new split
+ :open_vsplit [:<c-v>]
+ ;; open buffer in new vsplit
+ :open_tab [:<c-t>]
+ ;; 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. <esc> 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 ["<cmd>lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{sort_lastused = true, initial_mode = 'normal', previewer = false})<cr>"
"Switch buffers"]
+ :d [:<cmd>TroubleToggle<cr> :Trouble]
:f ["<cmd>lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})<cr>"
"Find files"]
:g ["<cmd>Telescope live_grep theme=ivy<cr>" "Find text"]