summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fnl/config/harpoon.fnl15
-rw-r--r--fnl/config/util.fnl12
-rw-r--r--fnl/config/which-key.fnl123
3 files changed, 88 insertions, 62 deletions
diff --git a/fnl/config/harpoon.fnl b/fnl/config/harpoon.fnl
index 9905439..9f9d2f2 100644
--- a/fnl/config/harpoon.fnl
+++ b/fnl/config/harpoon.fnl
@@ -5,10 +5,15 @@
(util.setup :harpoon opts)
-(nvim.set_keymap :n :<tab>
- "<cmd>lua require('telescope').extensions.harpoon.marks(require('telescope.themes').get_dropdown{previewer = false, initial_mode='normal', prompt_title='Harpoon'})<cr>"
- opts)
+(vim.keymap.set :n :<tab>
+ (fn []
+ (util.telescope-ext :harpoon :marks
+ {:theme :get_dropdown
+ :previewer false
+ :initial_mode :normal
+ :prompt_title :Harpoon}))
+ {})
(nvim.set_keymap :n :<s-tab>
- "<cmd>lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{previewer = false, initial_mode='normal'})<cr>"
- opts)
+ "<cmd>Telescope buffers theme=dropdown previewer=false initial_mode=normal<cr>"
+ {})
diff --git a/fnl/config/util.fnl b/fnl/config/util.fnl
index a4dcf5b..7665a57 100644
--- a/fnl/config/util.fnl
+++ b/fnl/config/util.fnl
@@ -11,3 +11,15 @@
(defn setup [plugin config]
(let [plugin (prequire plugin)]
(plugin.setup config)))
+
+(defn telescope-ext [ext fun opts]
+ (let [telescope (prequire :telescope)
+ themes (prequire :telescope.themes)
+ theme (. opts :theme)]
+ ((. (. (. telescope :extensions) ext) fun) ((. themes theme) opts))))
+
+(defn telescope-builtin [builtin opts]
+ (let [telescope (prequire :telescope.builtin)
+ themes (prequire :telescope.themes)
+ theme (. opts :theme)]
+ ((. telescope builtin) ((. themes theme) opts))))
diff --git a/fnl/config/which-key.fnl b/fnl/config/which-key.fnl
index 570040f..310f7c4 100644
--- a/fnl/config/which-key.fnl
+++ b/fnl/config/which-key.fnl
@@ -36,20 +36,23 @@
:noremap true
:nowait true})
-(def- mmappings {:a [:<cmd>HarpoonAdd<cr> :Harpoon]
- :c [:<cmd>DiffviewClose<cr> :DiffviewClose]
- :d [:<cmd>DiffviewFileHistory<cr> :DiffviewFileHistory]
- :x ["<cmd>DiffviewOpen -uno<cr>" :DiffviewOpen]
- :q ["<cmd>Gitsigns diffthis HEAD<cr>" "Gitsigns diff"]
- :f ["<cmd>lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})<cr>"
- "Find files"]
- :g ["<cmd>Telescope live_grep theme=dropdown<cr>" "Find text"]
- :l [:<cmd>HarpoonNext<cr> "Harpoon Next"]
- :h [:<cmd>HarpoonPrev<cr> "Harpoon Prev"]
- :v ["<cmd>lua vim.lsp.buf.rename()<cr>" :Rename]
- :p [:<cmd>SaveSession<cr> "Save Session"]
- :r [:<cmd>HarpoonUI<cr> "Harpoon UI"]
- :n [:<cmd>Neogit<cr> :Neogit]})
+(def- mmappings
+ {:a [:<cmd>HarpoonAdd<cr> :Harpoon]
+ :c [:<cmd>DiffviewClose<cr> :DiffviewClose]
+ :d [:<cmd>DiffviewFileHistory<cr> :DiffviewFileHistory]
+ :f [(fn []
+ (util.telescope-builtin :find_files
+ {:theme :get_dropdown :previewer false}))
+ "Find files"]
+ :g ["<cmd>Telescope live_grep theme=dropdown<cr>" "Find text"]
+ :n [:<cmd>Neogit<cr> :Neogit]
+ :p [:<cmd>SaveSession<cr> "Save Session"]
+ :q ["<cmd>Gitsigns diffthis HEAD<cr>" "Gitsigns diff"]
+ :r [:<cmd>HarpoonUI<cr> "Harpoon UI"]
+ :s [:<cmd>HarpoonPrev<cr> "Harpoon Prev"]
+ :t [:<cmd>HarpoonNext<cr> "Harpoon Next"]
+ :v ["<cmd>lua vim.lsp.buf.rename()<cr>" :Rename]
+ :x ["<cmd>DiffviewOpen -uno<cr>" :DiffviewOpen]})
(def- nopts {:mode :n
:prefix :<leader>
@@ -58,22 +61,25 @@
:noremap true
:nowait true})
-(def- find {:name :Find
- :b ["<cmd>Telescope git_branches theme=dropdown<cr>"
- "Checkout branch"]
- :c ["<cmd>Telescope colorscheme theme=dropdown<cr>" :Colorscheme]
- :f ["<cmd>Telescope find_files theme=dropdown<cr>" "Find files"]
- :t ["<cmd>Telescope live_grep theme=dropdown<cr>" "Find text"]
- :s [:<cmd>SearchSession<cr> "Find Session"]
- :S ["<cmd>Telescope grep_string theme=dropdown<cr>" "Find String"]
- :h ["<cmd>Telescope help_tags<cr>" :Help]
- :H ["<cmd>Telescope highlights<cr>" :Highlights]
- :l ["<cmd>Telescope resume<cr>" "Last Search"]
- :p ["<cmd>Telescope projects<cr>" "Find project"]
- :r ["<cmd>Telescope oldfiles theme=dropdown<cr>" "Recent File"]
- :R ["<cmd>Telescope registers<cr>" :Registers]
- :k ["<cmd>Telescope keymaps<cr>" :Keymaps]
- :C ["<cmd>Telescope commands<cr>" :Commands]})
+(def- find
+ {:name :Find
+ :C ["<cmd>Telescope commands theme=dropdown<cr>" :Commands]
+ :H ["<cmd>Telescope highlights<cr>" :Highlights]
+ :R ["<cmd>Telescope registers theme=dropdown<cr>" :Registers]
+ :S ["<cmd>Telescope grep_string theme=dropdown<cr>" "Find String"]
+ :b ["<cmd>Telescope git_branches theme=dropdown<cr>" "Checkout branch"]
+ :c ["<cmd>Telescope colorscheme theme=dropdown<cr>" :Colorscheme]
+ :f [(fn []
+ (util.telescope-builtin :find_files
+ {:theme :get_dropdown :previewer false}))
+ "Find files"]
+ :h ["<cmd>Telescope help_tags theme=dropdown<cr>" :Help]
+ :k ["<cmd>Telescope keymaps theme=dropdown<cr>" :Keymaps]
+ :l ["<cmd>Telescope resume theme=dropdown<cr>" "Last Search"]
+ :p ["<cmd>Telescope projects theme=dropdown<cr>" "Find project"]
+ :r ["<cmd>Telescope oldfiles theme=dropdown<cr>" "Recent File"]
+ :s [:<cmd>SearchSession<cr> "Find Session"]
+ :t ["<cmd>Telescope live_grep theme=dropdown<cr>" "Find text"]})
(def- diagnostics {:name :Diagnostics
:d [:<cmd>TroubleToggle<cr> :Trouble]
@@ -81,33 +87,34 @@
"Telescope diagnostics"]})
(def- git {:name :Git
+ :R ["<cmd>lua require 'gitsigns'.reset_buffer()<cr>" "Reset Buffer"]
+ :b ["<cmd>Telescope git_branches theme=dropdown<cr>"
+ "Checkout branch"]
+ :c ["<cmd>Telescope git_commits theme=dropdown<cr>"
+ "Checkout commit"]
+ :d ["<cmd>Gitsigns diffthis HEAD<cr>" :Diff]
:j ["<cmd>lua require 'gitsigns'.next_hunk()<cr>" "Next Hunk"]
:k ["<cmd>lua require 'gitsigns'.prev_hunk()<cr>" "Prev Hunk"]
:l ["<cmd>lua require 'gitsigns'.blame_line()<cr>" :Blame]
+ :o ["<cmd>Telescope git_status theme=dropdown<cr>"
+ "Open changed file"]
:p ["<cmd>lua require 'gitsigns'.preview_hunk()<cr>" "Preview Hunk"]
:r ["<cmd>lua require 'gitsigns'.reset_hunk()<cr>" "Reset Hunk"]
- :R ["<cmd>lua require 'gitsigns'.reset_buffer()<cr>" "Reset Buffer"]
:s ["<cmd>lua require 'gitsigns'.stage_hunk()<cr>" "Stage Hunk"]
:u ["<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>"
- "Undo Stage Hunk"]
- :o ["<cmd>Telescope git_status theme=dropdown<cr>"
- "Open changed file"]
- :b ["<cmd>Telescope git_branches theme=dropdown<cr>"
- "Checkout branch"]
- :c ["<cmd>Telescope git_commits theme=dropdown<cr>"
- "Checkout commit"]
- :d ["<cmd>Gitsigns diffthis HEAD<cr>" :Diff]})
-
-(def- lsp {:name :LSP
- :a ["<cmd>lua vim.lsp.buf.code_action()<cr>" "Code Action"]
- :f ["<cmd>lua vim.lsp.buf.format { async = true }<cr>" :Format]
- :i [:<cmd>LspInfo<cr> :Info]
- :l ["<cmd>lua vim.lsp.codelens.run()<cr>" "CodeLens Action"]
- :m [:<cmd>Mason<cr> :Mason]
- :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"]})
+ "Undo Stage Hunk"]})
+
+(def- lsp
+ {:name :LSP
+ :S ["<cmd>Telescope lsp_dynamic_workspace_symbols<cr>"
+ "Workspace Symbols"]
+ :a ["<cmd>lua vim.lsp.buf.code_action()<cr>" "Code Action"]
+ :f ["<cmd>lua vim.lsp.buf.format { async = true }<cr>" :Format]
+ :i [:<cmd>LspInfo<cr> :Info]
+ :l ["<cmd>lua vim.lsp.codelens.run()<cr>" "CodeLens Action"]
+ :m [:<cmd>Mason<cr> :Mason]
+ :r ["<cmd>lua vim.lsp.buf.rename()<cr>" :Rename]
+ :s ["<cmd>Telescope lsp_document_symbols<cr>" "Document Symbols"]})
(def- lazy {:name :Lazy
:C ["<cmd>Lazy check<cr>" :Check]
@@ -121,9 +128,9 @@
:u ["<cmd>Lazy update<cr>" :Update]})
(def- replace {:name :Replace
+ :f [:<cmd>ReplaceInBuf<cr> "Replace Buffer"]
:r [:<cmd>Replace<cr> :Replace]
- :w [:<cmd>ReplaceWord<cr> "Replace Word"]
- :f [:<cmd>ReplaceInBuf<cr> "Replace Buffer"]})
+ :w [:<cmd>ReplaceWord<cr> "Replace Word"]})
(def- treesitter
{:name :Treesitter :p [:<cmd>TSPlaygroundToggle<cr> :Playground]})
@@ -145,7 +152,9 @@
:l lsp
:n [:<cmd>CommentNormal<CR> :Comment]
:r replace
- :s [switch-window "Switch window"]
+ :s [(fn []
+ (switch-window))
+ "Switch window"]
:t [:<cmd>ToggleTerm<cr> :Terminal]
:u [:<cmd>UndotreeToggle<cr> :Undotree]
:y lazy
@@ -167,10 +176,10 @@
:noremap true
:nowait true})
-(def- gmappings
- {:a [:<cmd>OrgAgendaPrompt<cr> "Open agenda prompt"]
- :c [:<cmd>OrgCapturePrompt<cr> "Open capture prompt"]
- :m ["<cmd>Telescope orgmode search_headings theme=dropdown<cr>" "Search Headings"]})
+(def- gmappings {:a [:<cmd>OrgAgendaPrompt<cr> "Open agenda prompt"]
+ :c [:<cmd>OrgCapturePrompt<cr> "Open capture prompt"]
+ :m ["<cmd>Telescope orgmode search_headings theme=dropdown<cr>"
+ "Search Headings"]})
(let [which-key (util.prequire :which-key)]
(which-key.setup setup)