From 5679e90f8a687ff1ce33fb2e4f579e4c17ec2d51 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Tue, 3 Jan 2023 21:39:21 +0100 Subject: Fix loading of telescope --- fnl/config/which-key.fnl | 123 +++++++++++++++++++++++++---------------------- 1 file changed, 66 insertions(+), 57 deletions(-) (limited to 'fnl/config/which-key.fnl') 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 [:HarpoonAdd :Harpoon] - :c [:DiffviewClose :DiffviewClose] - :d [:DiffviewFileHistory :DiffviewFileHistory] - :x ["DiffviewOpen -uno" :DiffviewOpen] - :q ["Gitsigns diffthis HEAD" "Gitsigns diff"] - :f ["lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})" - "Find files"] - :g ["Telescope live_grep theme=dropdown" "Find text"] - :l [:HarpoonNext "Harpoon Next"] - :h [:HarpoonPrev "Harpoon Prev"] - :v ["lua vim.lsp.buf.rename()" :Rename] - :p [:SaveSession "Save Session"] - :r [:HarpoonUI "Harpoon UI"] - :n [:Neogit :Neogit]}) +(def- mmappings + {:a [:HarpoonAdd :Harpoon] + :c [:DiffviewClose :DiffviewClose] + :d [:DiffviewFileHistory :DiffviewFileHistory] + :f [(fn [] + (util.telescope-builtin :find_files + {:theme :get_dropdown :previewer false})) + "Find files"] + :g ["Telescope live_grep theme=dropdown" "Find text"] + :n [:Neogit :Neogit] + :p [:SaveSession "Save Session"] + :q ["Gitsigns diffthis HEAD" "Gitsigns diff"] + :r [:HarpoonUI "Harpoon UI"] + :s [:HarpoonPrev "Harpoon Prev"] + :t [:HarpoonNext "Harpoon Next"] + :v ["lua vim.lsp.buf.rename()" :Rename] + :x ["DiffviewOpen -uno" :DiffviewOpen]}) (def- nopts {:mode :n :prefix : @@ -58,22 +61,25 @@ :noremap true :nowait true}) -(def- find {:name :Find - :b ["Telescope git_branches theme=dropdown" - "Checkout branch"] - :c ["Telescope colorscheme theme=dropdown" :Colorscheme] - :f ["Telescope find_files theme=dropdown" "Find files"] - :t ["Telescope live_grep theme=dropdown" "Find text"] - :s [:SearchSession "Find Session"] - :S ["Telescope grep_string theme=dropdown" "Find String"] - :h ["Telescope help_tags" :Help] - :H ["Telescope highlights" :Highlights] - :l ["Telescope resume" "Last Search"] - :p ["Telescope projects" "Find project"] - :r ["Telescope oldfiles theme=dropdown" "Recent File"] - :R ["Telescope registers" :Registers] - :k ["Telescope keymaps" :Keymaps] - :C ["Telescope commands" :Commands]}) +(def- find + {:name :Find + :C ["Telescope commands theme=dropdown" :Commands] + :H ["Telescope highlights" :Highlights] + :R ["Telescope registers theme=dropdown" :Registers] + :S ["Telescope grep_string theme=dropdown" "Find String"] + :b ["Telescope git_branches theme=dropdown" "Checkout branch"] + :c ["Telescope colorscheme theme=dropdown" :Colorscheme] + :f [(fn [] + (util.telescope-builtin :find_files + {:theme :get_dropdown :previewer false})) + "Find files"] + :h ["Telescope help_tags theme=dropdown" :Help] + :k ["Telescope keymaps theme=dropdown" :Keymaps] + :l ["Telescope resume theme=dropdown" "Last Search"] + :p ["Telescope projects theme=dropdown" "Find project"] + :r ["Telescope oldfiles theme=dropdown" "Recent File"] + :s [:SearchSession "Find Session"] + :t ["Telescope live_grep theme=dropdown" "Find text"]}) (def- diagnostics {:name :Diagnostics :d [:TroubleToggle :Trouble] @@ -81,33 +87,34 @@ "Telescope diagnostics"]}) (def- git {:name :Git + :R ["lua require 'gitsigns'.reset_buffer()" "Reset Buffer"] + :b ["Telescope git_branches theme=dropdown" + "Checkout branch"] + :c ["Telescope git_commits theme=dropdown" + "Checkout commit"] + :d ["Gitsigns diffthis HEAD" :Diff] :j ["lua require 'gitsigns'.next_hunk()" "Next Hunk"] :k ["lua require 'gitsigns'.prev_hunk()" "Prev Hunk"] :l ["lua require 'gitsigns'.blame_line()" :Blame] + :o ["Telescope git_status theme=dropdown" + "Open changed file"] :p ["lua require 'gitsigns'.preview_hunk()" "Preview Hunk"] :r ["lua require 'gitsigns'.reset_hunk()" "Reset Hunk"] - :R ["lua require 'gitsigns'.reset_buffer()" "Reset Buffer"] :s ["lua require 'gitsigns'.stage_hunk()" "Stage Hunk"] :u ["lua require 'gitsigns'.undo_stage_hunk()" - "Undo Stage Hunk"] - :o ["Telescope git_status theme=dropdown" - "Open changed file"] - :b ["Telescope git_branches theme=dropdown" - "Checkout branch"] - :c ["Telescope git_commits theme=dropdown" - "Checkout commit"] - :d ["Gitsigns diffthis HEAD" :Diff]}) - -(def- lsp {:name :LSP - :a ["lua vim.lsp.buf.code_action()" "Code Action"] - :f ["lua vim.lsp.buf.format { async = true }" :Format] - :i [:LspInfo :Info] - :l ["lua vim.lsp.codelens.run()" "CodeLens Action"] - :m [:Mason :Mason] - :r ["lua vim.lsp.buf.rename()" :Rename] - :s ["Telescope lsp_document_symbols" "Document Symbols"] - :S ["Telescope lsp_dynamic_workspace_symbols" - "Workspace Symbols"]}) + "Undo Stage Hunk"]}) + +(def- lsp + {:name :LSP + :S ["Telescope lsp_dynamic_workspace_symbols" + "Workspace Symbols"] + :a ["lua vim.lsp.buf.code_action()" "Code Action"] + :f ["lua vim.lsp.buf.format { async = true }" :Format] + :i [:LspInfo :Info] + :l ["lua vim.lsp.codelens.run()" "CodeLens Action"] + :m [:Mason :Mason] + :r ["lua vim.lsp.buf.rename()" :Rename] + :s ["Telescope lsp_document_symbols" "Document Symbols"]}) (def- lazy {:name :Lazy :C ["Lazy check" :Check] @@ -121,9 +128,9 @@ :u ["Lazy update" :Update]}) (def- replace {:name :Replace + :f [:ReplaceInBuf "Replace Buffer"] :r [:Replace :Replace] - :w [:ReplaceWord "Replace Word"] - :f [:ReplaceInBuf "Replace Buffer"]}) + :w [:ReplaceWord "Replace Word"]}) (def- treesitter {:name :Treesitter :p [:TSPlaygroundToggle :Playground]}) @@ -145,7 +152,9 @@ :l lsp :n [:CommentNormal :Comment] :r replace - :s [switch-window "Switch window"] + :s [(fn [] + (switch-window)) + "Switch window"] :t [:ToggleTerm :Terminal] :u [:UndotreeToggle :Undotree] :y lazy @@ -167,10 +176,10 @@ :noremap true :nowait true}) -(def- gmappings - {:a [:OrgAgendaPrompt "Open agenda prompt"] - :c [:OrgCapturePrompt "Open capture prompt"] - :m ["Telescope orgmode search_headings theme=dropdown" "Search Headings"]}) +(def- gmappings {:a [:OrgAgendaPrompt "Open agenda prompt"] + :c [:OrgCapturePrompt "Open capture prompt"] + :m ["Telescope orgmode search_headings theme=dropdown" + "Search Headings"]}) (let [which-key (util.prequire :which-key)] (which-key.setup setup) -- cgit v1.2.3-70-g09d2