diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-01-17 00:08:43 +0100 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-01-17 00:08:43 +0100 |
commit | a48ba3f7dfe35c7ca622e63a72574134788d68c7 (patch) | |
tree | 0675dc0f5e950c8739b63da29568d083e9c1d057 /fnl/plugins/editor | |
parent | 10b175f252104458d7478d8a2822818850cfdf92 (diff) |
Update key mappings
Diffstat (limited to 'fnl/plugins/editor')
-rw-r--r-- | fnl/plugins/editor/bufdel.fnl | 4 | ||||
-rw-r--r-- | fnl/plugins/editor/colorizer.fnl | 5 | ||||
-rw-r--r-- | fnl/plugins/editor/gitsigns.fnl | 27 | ||||
-rw-r--r-- | fnl/plugins/editor/harpoon.fnl | 4 | ||||
-rw-r--r-- | fnl/plugins/editor/persistence.fnl | 7 | ||||
-rw-r--r-- | fnl/plugins/editor/spectre.fnl | 7 | ||||
-rw-r--r-- | fnl/plugins/editor/telescope.fnl | 59 | ||||
-rw-r--r-- | fnl/plugins/editor/toggleterm.fnl | 1 | ||||
-rw-r--r-- | fnl/plugins/editor/trouble.fnl | 5 | ||||
-rw-r--r-- | fnl/plugins/editor/undotree.fnl | 4 | ||||
-rw-r--r-- | fnl/plugins/editor/which-key.fnl | 144 | ||||
-rw-r--r-- | fnl/plugins/editor/zen.fnl | 1 |
12 files changed, 126 insertions, 142 deletions
diff --git a/fnl/plugins/editor/bufdel.fnl b/fnl/plugins/editor/bufdel.fnl index 4719a53..ad40db3 100644 --- a/fnl/plugins/editor/bufdel.fnl +++ b/fnl/plugins/editor/bufdel.fnl @@ -1,3 +1,5 @@ ;; Delete buffers. -{1 :ojroques/nvim-bufdel :cmd :BufDel} +{1 :ojroques/nvim-bufdel + :cmd :BufDel + :keys [{1 :<leader><BS> 2 :<cmd>BufDel<CR> :desc "Close Buffer"}]} diff --git a/fnl/plugins/editor/colorizer.fnl b/fnl/plugins/editor/colorizer.fnl index 553024b..67f05dd 100644 --- a/fnl/plugins/editor/colorizer.fnl +++ b/fnl/plugins/editor/colorizer.fnl @@ -1,3 +1,6 @@ ;; Display colors of hex numbers. -{1 :norcalli/nvim-colorizer.lua :cmd :ColorizerToggle :config true} +{1 :norcalli/nvim-colorizer.lua + :cmd :ColorizerToggle + :config true + :keys [{1 :<leader>h 2 :<cmd>ColorizerToggle<cr> :desc :Colorizer}]} diff --git a/fnl/plugins/editor/gitsigns.fnl b/fnl/plugins/editor/gitsigns.fnl index 1ef8cbc..86f001c 100644 --- a/fnl/plugins/editor/gitsigns.fnl +++ b/fnl/plugins/editor/gitsigns.fnl @@ -1,5 +1,32 @@ ;; Add git signs to source files. +(local keys [{1 :mq 2 "<cmd>Gitsigns diffthis HEAD<cr>" :desc "Gitsigns diff"} + {1 :<leader>gR + 2 "<cmd>lua require 'gitsigns'.reset_buffer()<cr>" + :desc "Reset Buffer"} + {1 :<leader>gd 2 "<cmd>Gitsigns diffthis HEAD<cr>" :desc :Diff} + {1 :<leader>gj + 2 "<cmd>lua require 'gitsigns'.next_hunk()<cr>" + :desc "Next Hunk"} + {1 :<leader>gk + 2 "<cmd>lua require 'gitsigns'.prev_hunk()<cr>" + :desc "Prev Hunk"} + {1 :<leader>gl + 2 "<cmd>lua require 'gitsigns'.blame_line()<cr>" + :desc :Blame} + {1 :<leader>gp + 2 "<cmd>lua require 'gitsigns'.preview_hunk()<cr>" + :desc "Preview Hunk"} + {1 :<leader>gr + 2 "<cmd>lua require 'gitsigns'.reset_hunk()<cr>" + :desc "Reset Hunk"} + {1 :<leader>gs + 2 "<cmd>lua require 'gitsigns'.stage_hunk()<cr>" + :desc "Stage Hunk"} + {1 :<leader>gu + 2 "<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>" + :desc "Undo Stage Hunk"}]) + (local signs {:add {:hl :GitSignsAdd :text "|" :numhl :GitSignsAddNr diff --git a/fnl/plugins/editor/harpoon.fnl b/fnl/plugins/editor/harpoon.fnl index 7674f0b..876386e 100644 --- a/fnl/plugins/editor/harpoon.fnl +++ b/fnl/plugins/editor/harpoon.fnl @@ -21,5 +21,9 @@ {1 :ThePrimeagen/harpoon :event :BufReadPost + :keys [{1 :ma 2 :<cmd>HarpoonAdd<cr> :desc :Harpoon} + {1 :mr 2 :<cmd>HarpoonUI<cr> :desc "Harpoon UI"} + {1 :ms 2 :<cmd>HarpoonPrev<cr> :desc "Harpoon Prev"} + {1 :mt 2 :<cmd>HarpoonNext<cr> :desc "Harpoon Next"}] :config (fn [] (setup))} diff --git a/fnl/plugins/editor/persistence.fnl b/fnl/plugins/editor/persistence.fnl index 4cde73e..0b4e7a8 100644 --- a/fnl/plugins/editor/persistence.fnl +++ b/fnl/plugins/editor/persistence.fnl @@ -2,4 +2,11 @@ {1 :folke/persistence.nvim :event :VeryLazy + :keys [{1 :<leader>sn 2 :<cmd>RestoreSession<cr> :desc "Restore session"} + {1 :<leader>se + 2 :<cmd>RestoreLastSession<cr> + :desc "Restore last session"} + {1 :<leader>si + 2 :<cmd>IgnoreSession<cr> + :desc "Ignore current session"}] :opts {:options [:buffers :curdir :tabpages :winsize :help]}} diff --git a/fnl/plugins/editor/spectre.fnl b/fnl/plugins/editor/spectre.fnl index 92a33ba..526b196 100644 --- a/fnl/plugins/editor/spectre.fnl +++ b/fnl/plugins/editor/spectre.fnl @@ -51,4 +51,9 @@ :is_open_target_win true :is_insert_mode false}) -{1 :windwp/nvim-spectre :event :BufReadPost : opts} +{1 :windwp/nvim-spectre + :event :BufReadPost + :keys [{1 :<leader>rn 2 :<cmd>ReplaceInBuf<cr> :desc "Replace in Buffer"} + {1 :<leader>re 2 :<cmd>Replace<cr> :desc :Replace} + {1 :<leader>ri 2 :<cmd>ReplaceWord<cr> :desc "Replace Word"}] + : opts} diff --git a/fnl/plugins/editor/telescope.fnl b/fnl/plugins/editor/telescope.fnl index df8c031..163a322 100644 --- a/fnl/plugins/editor/telescope.fnl +++ b/fnl/plugins/editor/telescope.fnl @@ -1,5 +1,59 @@ ;; Telescope a highly extendable fuzzy finder over lists. +(local keys [{1 :mf 2 :<cmd>FindFiles<cr> :desc "Find Files"} + {1 :mg + 2 "<cmd>Telescope live_grep theme=dropdown<cr>" + :desc "Find Text"} + {1 :<leader>fc + 2 "<cmd>Telescope commands theme=dropdown<cr>" + :desc :Commands} + {1 :<leader>fH + 2 "<cmd>Telescope highlights<cr>" + :desc :Highlights} + {1 :<leader>fR + 2 "<cmd>Telescope registers theme=dropdown<cr>" + :desc :Registers} + {1 :<leader>fS + 2 "<cmd>Telescope grep_string theme=dropdown<cr>" + :desc "Find String"} + {1 :<leader>fb + 2 "<cmd>Telescope git_branches theme=dropdown<cr>" + :desc "Checkout Branch"} + {1 :<leader>ff 2 :<cmd>FindFiles<cr> :desc "Find files"} + {1 :<leader>fh + 2 "<cmd>Telescope help_tags theme=dropdown<cr>" + :desc :Help} + {1 :<leader>fk + 2 "<cmd>Telescope keymaps theme=dropdown<cr>" + :desc :Keymaps} + {1 :<leader>fl + 2 "<cmd>Telescope resume theme=dropdown<cr>" + :desc "Last Search"} + {1 :<leader>fp + 2 "<cmd>Telescope projects theme=dropdown<cr>" + :desc "Find Project"} + {1 :<leader>fr + 2 "<cmd>Telescope oldfiles theme=dropdown<cr>" + :desc "Recent File"} + {1 :<leader>ft + 2 "<cmd>Telescope live_grep theme=dropdown<cr>" + :desc "Find Text"} + {1 :<leader>js + 2 "<cmd>Telescope diagnostics theme=dropdown<cr>" + :desc "Telescope Diagnostics"} + {1 :<leader>gb + 2 "<cmd>Telescope git_branches theme=dropdown<cr>" + :desc "Checkout Branch"} + {1 :<leader>gc + 2 "<cmd>Telescope git_commits theme=dropdown<cr>" + :desc "Checkout Commit"} + {1 :<leader>lS + 2 "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>" + :desc "Workspace Symbols"} + {1 :<leader>n + 2 "<cmd>Telescope lsp_document_symbols theme=dropdown<cr>" + :desc "Document Symbols"}]) + (fn setup [] (let [telescope (require :telescope) actions (require :telescope.actions)] @@ -81,6 +135,8 @@ {1 :nvim-telescope/telescope.nvim :cmd :Telescope + :config (fn [] + (setup)) :dependencies [:nvim-lua/popup.nvim :nvim-telescope/telescope-frecency.nvim {1 :nvim-telescope/telescope-fzf-native.nvim :build :make} @@ -109,5 +165,4 @@ :nvim-telescope/telescope-fzf-native.nvim :nvim-telescope/telescope-frecency.nvim :joaomsa/telescope-orgmode.nvim] - :config (fn [] - (setup))} + : keys} diff --git a/fnl/plugins/editor/toggleterm.fnl b/fnl/plugins/editor/toggleterm.fnl index d75aea1..3086d40 100644 --- a/fnl/plugins/editor/toggleterm.fnl +++ b/fnl/plugins/editor/toggleterm.fnl @@ -2,4 +2,5 @@ {1 :akinsho/toggleterm.nvim :cmd :ToggleTerm + :keys [{1 :<leader>t 2 :<cmd>ToggleTerm<cr> :desc :Terminal}] :opts {:size 16 :shade_terminals false}} diff --git a/fnl/plugins/editor/trouble.fnl b/fnl/plugins/editor/trouble.fnl index 3f736bb..9fb8f6d 100644 --- a/fnl/plugins/editor/trouble.fnl +++ b/fnl/plugins/editor/trouble.fnl @@ -78,4 +78,7 @@ ;; enabling this will use the signs defined in your lsp client }) -{1 :folke/trouble.nvim :cmd :TroubleToggle : opts} +{1 :folke/trouble.nvim + :cmd :TroubleToggle + :keys [{1 :<leader>jt 2 :<cmd>TroubleToggle<cr> :desc :Trouble}] + : opts} diff --git a/fnl/plugins/editor/undotree.fnl b/fnl/plugins/editor/undotree.fnl index 9aa8114..05de139 100644 --- a/fnl/plugins/editor/undotree.fnl +++ b/fnl/plugins/editor/undotree.fnl @@ -1,3 +1,5 @@ ;; Tree of undo history. -{1 :mbbill/undotree :cmd :UndotreeToggle} +{1 :mbbill/undotree + :cmd :UndotreeToggle + :keys [{1 :<leader>u 2 :<cmd>UndotreeToggle<cr> :desc :Undotree}]} diff --git a/fnl/plugins/editor/which-key.fnl b/fnl/plugins/editor/which-key.fnl index 0b6389c..9ea8ff8 100644 --- a/fnl/plugins/editor/which-key.fnl +++ b/fnl/plugins/editor/which-key.fnl @@ -10,157 +10,31 @@ :nav true :z true :g true}} - :icons {:breadcrumb "»" :separator "" :group "+"} + :icons {:breadcrumb "»" :separator " " :group "+"} :popup_mappings {:scroll_down :<c-d> :scroll_up :<c-u>} :window {:border :rounded :position :bottom :winblend 0} :layout {:height {:min 4 :max 25} :width {:min 20 :max 50} :spacing 3 :align :left} - :ignore_missing true :hidden [:<silent> :<cmd> :<Cmd> :<CR> :call :lua "^:" "^ "] :show_help true :triggers :auto :disable {:filetypes [:netrw]} :triggers_blacklist {:i [:j :k] :v [:j :k]}}) -(local mopts {:mode :n - :prefix :m - :buffer nil - :silent true - :noremap true - :nowait true}) - -(local mmappings {:a [:<cmd>HarpoonAdd<cr> :Harpoon] - :d [:<cmd>DiffviewFileHistory<cr> :DiffviewFileHistory] - :f [:<cmd>FindFiles<cr> "Find files"] - :g ["<cmd>Telescope live_grep theme=dropdown<cr>" - "Find text"] - :n [:<cmd>Neogit<cr> :Neogit] - :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] - :z [:<cmd>DiffviewClose<cr> :DiffviewClose]}) - -(local nopts {:mode :n - :prefix :<leader> - :buffer nil - :silent true - :noremap true - :nowait true}) - -(local 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 [:<cmd>FindFiles<cr> "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"] - :t ["<cmd>Telescope live_grep theme=dropdown<cr>" "Find text"]}) - -(local diagnostics {:name :diagnostics - :t [:<cmd>TroubleToggle<cr> :Trouble] - :g ["<cmd>Telescope diagnostics theme=dropdown<cr>" - "Telescope diagnostics"]}) - -(local 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"] - :s ["<cmd>lua require 'gitsigns'.stage_hunk()<cr>" "Stage Hunk"] - :u ["<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>" - "Undo Stage Hunk"]}) - -(local 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"] - :r ["<cmd>lua vim.lsp.buf.rename()<cr>" :Rename] - :s ["<cmd>Telescope lsp_document_symbols<cr>" "Document Symbols"]}) - -(local replace {:name :replace - :m [:<cmd>ReplaceInBuf<cr> "Replace in Buffer"] - :n [:<cmd>Replace<cr> :Replace] - :e [:<cmd>ReplaceWord<cr> "Replace Word"]}) - -(local session - {:name :session - :m [:<cmd>RestoreSession<cr> "Restore session"] - :n [:<cmd>RestoreLastSession<cr> "Restore last session"] - :e [:<cmd>IgnoreSession<cr> "Ignore current session"]}) - -(local treesitter - {:name :Treesitter :p [:<cmd>TSPlaygroundToggle<cr> :Playground]}) - -(local nmappings {:a ["<cmd>Telescope lsp_document_symbols theme=dropdown<cr>" - "Document Symbols"] - :T treesitter - :<BS> [:<cmd>BufDel<CR> "Close Buffer"] - :j diagnostics - :f find - :g git - :h [:<cmd>ColorizerToggle<cr> :Colorizer] - :l lsp - :m [:<cmd>Mason<cr> :Mason] - :n [:<cmd>SymbolsOutline<cr> "Symbols outline"] - :r replace - :s session - :t [:<cmd>ToggleTerm<cr> :Terminal] - :u [:<cmd>UndotreeToggle<cr> :Undotree] - :y ["<cmd>Lazy home<cr>" :Home] - :z [:<cmd>ZenMode<cr> "Zen Mode"]}) - -(local vopts {:mode :v - :prefix :<leader> - :buffer nil - :silent true - :noremap true - :nowait true}) - -(local gopts {:mode :n - :prefix :g - :buffer nil - :silent true - :noremap true - :nowait true}) - -(local 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"]}) +(local groups {:mode [:n :v] + :<leader>g {:name :+git} + :<leader>j {:name :+diagnostics} + :<leader>f {:name :+find} + :<leader>l {:name :+lsp} + :<leader>r {:name :+replace} + :<leader>s {:name :+session}}) (fn setup [] (let [which-key (require :which-key)] (which-key.setup opts) - (which-key.register mmappings mopts) - (which-key.register nmappings nopts) - (which-key.register gmappings gopts))) + (which-key.register groups))) {1 :folke/which-key.nvim :event :VeryLazy diff --git a/fnl/plugins/editor/zen.fnl b/fnl/plugins/editor/zen.fnl index 6e9bee7..11685af 100644 --- a/fnl/plugins/editor/zen.fnl +++ b/fnl/plugins/editor/zen.fnl @@ -2,6 +2,7 @@ {1 :folke/zen-mode.nvim :cmd :ZenMode + :keys [{1 :<leader>z 2 :<cmd>ZenMode<cr> :desc "Zen Mode"}] :opts {:window {:backdrop 1 :height 1 :width 120 |