summaryrefslogtreecommitdiff
path: root/fnl/config
diff options
context:
space:
mode:
Diffstat (limited to 'fnl/config')
-rw-r--r--fnl/config/which-key.fnl151
1 files changed, 88 insertions, 63 deletions
diff --git a/fnl/config/which-key.fnl b/fnl/config/which-key.fnl
index 65997b3..4508f58 100644
--- a/fnl/config/which-key.fnl
+++ b/fnl/config/which-key.fnl
@@ -28,36 +28,41 @@
:triggers :auto
:triggers_blacklist {:i [:j :k] :v [:j :k]}})
-(def- opts {:mode :n
- :prefix :<leader>
- :buffer nil
- :silent true
- :noremap true
- :nowait true})
+(def- nopts {:mode :n
+ :prefix :<leader>
+ :buffer nil
+ :silent true
+ :noremap true
+ :nowait true})
+
+(def- vopts {:mode :v
+ :prefix :<leader>
+ :buffer nil
+ :silent true
+ :noremap true
+ :nowait true})
+
+(def- aerial {:name :Aerial
+ :a [:<cmd>AerialToggle!<CR> "Toggle Aerial"]
+ :c [:<cmd>AerialClose<CR> "Close Aerial"]})
-(def- mappings
- {:k ["<cmd>lua require('Comment.api').toggle_current_linewise()<CR>"
- :Comment]
- :A [:<cmd>Alpha<cr> :Alpha]
- :a {:name :Aerial
- :a [:<cmd>AerialToggle!<CR> "Toggle Aerial"]
- :c [:<cmd>AerialClose<CR> "Close Aerial"]}
- :e [:<cmd>NvimTreeToggle<cr> :Explorer]
- :c [:<cmd>Bdelete!<CR> "Close Buffer"]
- :P ["<cmd>Telescope projects<cr>" :Projects]
- :z [:<cmd>ZenMode<cr> "Zen Mode"]
- :b ["<cmd>lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{sort_lastused = true, initial_mode = 'normal', previewer = false})<cr>"
- "Switch buffers"]
- :f ["<cmd>lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})<cr>"
- "Find files"]
- :t ["<cmd>Telescope live_grep theme=ivy<cr>" "Find text"]
- :p {:name :Packer
- :c [:<cmd>PackerCompile<cr> :Compile]
- :i [:<cmd>PackerInstall<cr> :Install]
- :s [:<cmd>PackerSync<cr> :Sync]
- :S [:<cmd>PackerStatus<cr> :Status]
- :u [:<cmd>PackerUpdate<cr> :Update]}
- :g {:name :Git
+(def- find {:name :Find
+ :b ["<cmd>Telescope git_branches<cr>" "Checkout branch"]
+ :c ["<cmd>Telescope colorscheme<cr>" :Colorscheme]
+ :f ["<cmd>lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})<cr>"
+ "Find files"]
+ :t ["<cmd>Telescope live_grep theme=ivy<cr>" "Find text"]
+ :s ["<cmd>Telescope grep_string<cr>" "Find String"]
+ :h ["<cmd>Telescope help_tags<cr>" :Help]
+ :H ["<cmd>Telescope highlights<cr>" :Highlights]
+ :l ["<cmd>Telescope resume<cr>" "Last Search"]
+ :M ["<cmd>Telescope man_pages<cr>" "Man Pages"]
+ :r ["<cmd>Telescope oldfiles<cr>" "Recent File"]
+ :R ["<cmd>Telescope registers<cr>" :Registers]
+ :k ["<cmd>Telescope keymaps<cr>" :Keymaps]
+ :C ["<cmd>Telescope commands<cr>" :Commands]})
+
+(def- git {:name :Git
:g ["<cmd>lua _LAZYGIT_TOGGLE()<CR>" :Lazygit]
:j ["<cmd>lua require 'gitsigns'.next_hunk()<cr>" "Next Hunk"]
:k ["<cmd>lua require 'gitsigns'.prev_hunk()<cr>" "Prev Hunk"]
@@ -72,8 +77,9 @@
:b ["<cmd>Telescope git_branches<cr>" "Checkout branch"]
:c ["<cmd>Telescope git_commits<cr>" "Checkout commit"]
:d ["<cmd>Gitsigns diffthis HEAD<cr>" :Diff]
- :n [:<cmd>Neogit<cr> :Neogit]}
- :l {:name :LSP
+ :n [:<cmd>Neogit<cr> :Neogit]})
+
+(def- lsp {:name :LSP
:a ["<cmd>lua vim.lsp.buf.code_action()<cr>" "Code Action"]
:d ["<cmd>Telescope lsp_document_diagnostics<cr>"
"Document Diagnostics"]
@@ -81,50 +87,69 @@
"Workspace Diagnostics"]
:f ["<cmd>lua vim.lsp.buf.format { async = true }<cr>" :Format]
:i [:<cmd>LspInfo<cr> :Info]
- :j ["<cmd>lua vim.lsp.diagnostic.goto_next({buffer=0})<CR>" "Next Diagnostic"]
- :k ["<cmd>lua vim.lsp.diagnostic.goto_prev({buffer=0})<cr>" "Prev Diagnostic"]
+ :j ["<cmd>lua vim.lsp.diagnostic.goto_next({buffer=0})<CR>"
+ "Next Diagnostic"]
+ :k ["<cmd>lua vim.lsp.diagnostic.goto_prev({buffer=0})<cr>"
+ "Prev Diagnostic"]
:l ["<cmd>lua vim.lsp.codelens.run()<cr>" "CodeLens Action"]
:q ["<cmd>lua vim.lsp.diagnostic.set_loclist()<cr>" :Quickfix]
:r ["<cmd>lua vim.lsp.buf.rename()<cr>" :Rename]
:s ["<cmd>Telescope lsp_document_symbols<cr>" "Document Symbols"]
:S ["<cmd>Telescope lsp_dynamic_workspace_symbols<cr>"
- "Workspace Symbols"]}
- :s [(fn switch-window []
- (let [window-picker (require :window-picker)]
- (let [win (window-picker.pick_window)]
- (if (not= win nil)
- (nvim.set_current_win win)))))
- "Switch window"]
- :o {:name :Orgmode
+ "Workspace Symbols"]})
+
+(def- org {:name :Orgmode
:a ["<cmd>lua require('orgmode').action('agenda.prompt')"
"Open agenda prompt"]
:c ["<cmd>lua require('orgmode').action('capture.prompt')"
- "Open capture prompt"]}
- :r {:name :Replace
- :r ["<cmd>lua require('spectre').open()<cr>" :Replace]
- :w ["<cmd>lua require('spectre').open_visual({select_word=true})<cr>"
- "Replace Word"]
- :f ["<cmd>lua require('spectre').open_file_search()<cr>"
- "Replace Buffer"]}
- :s [(fn switch-window []
- (let [window-picker (require :window-picker)]
- (let [win (window-picker.pick_window)]
- (if (not= win nil)
- (nvim.set_current_win win)))))
- "Switch window"]
- :T {:name :Treesitter :p [:<cmd>TSPlaygroundToggle<cr> :Playground]}})
+ "Open capture prompt"]})
-(def- vopts {:mode :v
- :prefix :<leader>
- :buffer nil
- :silent true
- :noremap true
- :nowait true})
+(def- packer {:name :Packer
+ :c [:<cmd>PackerCompile<cr> :Compile]
+ :i [:<cmd>PackerInstall<cr> :Install]
+ :s [:<cmd>PackerSync<cr> :Sync]
+ :S [:<cmd>PackerStatus<cr> :Status]
+ :u [:<cmd>PackerUpdate<cr> :Update]})
+
+(def- replace {:name :Replace
+ :r ["<cmd>lua require('spectre').open()<cr>" :Replace]
+ :w ["<cmd>lua require('spectre').open_visual({select_word=true})<cr>"
+ "Replace Word"]
+ :f ["<cmd>lua require('spectre').open_file_search()<cr>"
+ "Replace Buffer"]})
+
+(def- treesitter
+ {:name :Treesitter :p [:<cmd>TSPlaygroundToggle<cr> :Playground]})
+
+(defn- switch-window []
+ (let [window-picker (require :window-picker)]
+ (let [win (window-picker.pick_window)]
+ (if (not= win nil)
+ (nvim.set_current_win win)))))
+
+(def- nmappings {:a aerial
+ :b ["<cmd>lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{sort_lastused = true, initial_mode = 'normal', previewer = false})<cr>"
+ "Switch buffers"]
+ :c [:<cmd>Bdelete!<CR> "Close Buffer"]
+ :e [:<cmd>NvimTreeToggle<cr> :Explorer]
+ :f find
+ :g git
+ :h [:<cmd>Alpha<cr> :Alpha]
+ :l lsp
+ :n ["<cmd>lua require('Comment.api').toggle_current_linewise()<CR>"
+ :Comment]
+ :o org
+ :p packer
+ :r replace
+ :s [switch-window "Switch window"]
+ :t [:<cmd>ToggleTerm<cr> :Terminal]
+ :T treesitter
+ :z [:<cmd>ZenMode<cr> "Zen Mode"]})
-(def- vmappings {:k ["<ESC><CMD>lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>"
+(def- vmappings {:n ["<ESC><CMD>lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>"
:Comment]})
(let [which-key (util.load-plugin :which-key)]
(which-key.setup setup)
- (which-key.register mappings opts)
+ (which-key.register nmappings nopts)
(which-key.register vmappings vopts))