summaryrefslogtreecommitdiff
path: root/fnl
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2023-01-17 00:08:43 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2023-01-17 00:08:43 +0100
commita48ba3f7dfe35c7ca622e63a72574134788d68c7 (patch)
tree0675dc0f5e950c8739b63da29568d083e9c1d057 /fnl
parent10b175f252104458d7478d8a2822818850cfdf92 (diff)
Update key mappings
Diffstat (limited to 'fnl')
-rw-r--r--fnl/plugins/core/lazy.fnl1
-rw-r--r--fnl/plugins/editor/bufdel.fnl4
-rw-r--r--fnl/plugins/editor/colorizer.fnl5
-rw-r--r--fnl/plugins/editor/gitsigns.fnl27
-rw-r--r--fnl/plugins/editor/harpoon.fnl4
-rw-r--r--fnl/plugins/editor/persistence.fnl7
-rw-r--r--fnl/plugins/editor/spectre.fnl7
-rw-r--r--fnl/plugins/editor/telescope.fnl59
-rw-r--r--fnl/plugins/editor/toggleterm.fnl1
-rw-r--r--fnl/plugins/editor/trouble.fnl5
-rw-r--r--fnl/plugins/editor/undotree.fnl4
-rw-r--r--fnl/plugins/editor/which-key.fnl144
-rw-r--r--fnl/plugins/editor/zen.fnl1
-rw-r--r--fnl/plugins/lsp/keymaps.fnl34
-rw-r--r--fnl/plugins/tools/diffview.fnl5
-rw-r--r--fnl/plugins/tools/neogit.fnl4
-rw-r--r--fnl/plugins/tools/orgmode.fnl9
-rw-r--r--fnl/settings/keymaps.fnl55
18 files changed, 196 insertions, 180 deletions
diff --git a/fnl/plugins/core/lazy.fnl b/fnl/plugins/core/lazy.fnl
index f7b8371..69ad103 100644
--- a/fnl/plugins/core/lazy.fnl
+++ b/fnl/plugins/core/lazy.fnl
@@ -28,6 +28,7 @@
(fn setup [plugins]
(let [lazy (require :lazy)]
+ (vim.keymap.set :n :<leader>y "Lazy home" {:desc :Home})
(lazy.setup plugins opts)))
{: setup}
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
diff --git a/fnl/plugins/lsp/keymaps.fnl b/fnl/plugins/lsp/keymaps.fnl
index cd62073..fdcf53f 100644
--- a/fnl/plugins/lsp/keymaps.fnl
+++ b/fnl/plugins/lsp/keymaps.fnl
@@ -3,16 +3,36 @@
(local opts {:noremap true :silent true})
(local mappings
- [[:n :gD "<cmd>lua vim.lsp.buf.declaration()<CR>"]
- [:n :gd "<cmd>lua vim.lsp.buf.definition()<CR>"]
- [:n :gI "<cmd>lua vim.lsp.buf.implementation()<CR>"]
- [:n :gr "<cmd>lua vim.lsp.buf.references()<CR>"]
- [:n :gl "<cmd>lua vim.diagnostic.open_float()<CR>"]
- [:n :gs "<cmd>lua vim.lsp.buf.signature_help()<CR>"]])
+ [[:n :gD "<cmd>lua vim.lsp.buf.declaration()<CR>" {:desc :Declaration}]
+ [:n :gd "<cmd>lua vim.lsp.buf.definition()<CR>" {:desc :Definition}]
+ [:n
+ :gI
+ "<cmd>lua vim.lsp.buf.implementation()<CR>"
+ {:desc :Implementation}]
+ [:n :gr "<cmd>lua vim.lsp.buf.references()<CR>" {:desc :References}]
+ [:n
+ :gl
+ "<cmd>lua vim.diagnostic.open_float()<CR>"
+ {:desc :Diagnostics}]
+ [:n :gs "<cmd>lua vim.lsp.buf.signature_help()<CR>" {:desc :Signature}]
+ [:n :gv "<cmd>lua vim.lsp.buf.rename()<cr>" {:desc :Rename}]
+ [:n
+ :<leader>a
+ "<cmd>lua vim.lsp.buf.code_action()<cr>"
+ {:desc "Code Action"}]
+ [:n
+ :<leader>e
+ "<cmd>lua vim.lsp.buf.format { async = true }<cr>"
+ {:desc :Format}]
+ [:n
+ :<leader>i
+ "<cmd>lua vim.lsp.codelens.run()<cr>"
+ {:desc "Code Lens"}]
+ [:n :<leader>li :<cmd>LspInfo<cr> {:desc "Lsp Info"}]])
(fn on-attach [bufnr]
(each [_ mapping (ipairs mappings)]
(match mapping
- [mode key cmd] (vim.api.nvim_buf_set_keymap bufnr mode key cmd opts))))
+ [mode key cmd desc] (vim.api.nvim_buf_set_keymap bufnr mode key cmd (vim.tbl_extend :force opts desc)))))
{: on-attach}
diff --git a/fnl/plugins/tools/diffview.fnl b/fnl/plugins/tools/diffview.fnl
index 9978c2e..c004199 100644
--- a/fnl/plugins/tools/diffview.fnl
+++ b/fnl/plugins/tools/diffview.fnl
@@ -2,4 +2,7 @@
{1 :sindrets/diffview.nvim
:cmd [:DiffviewFileHistory :DiffviewOpen]
- :config true}
+ :config true
+ :keys [{1 :md 2 :<cmd>DiffviewFileHistory<cr> :desc :DiffviewFileHistory}
+ {1 :mx 2 "<cmd>DiffviewOpen -uno<cr>" :desc :DiffviewOpen}
+ {1 :mz 2 :<cmd>DiffviewClose<cr> :desc :DiffviewClose}]}
diff --git a/fnl/plugins/tools/neogit.fnl b/fnl/plugins/tools/neogit.fnl
index b7c1633..9bd3afd 100644
--- a/fnl/plugins/tools/neogit.fnl
+++ b/fnl/plugins/tools/neogit.fnl
@@ -2,5 +2,7 @@
{1 :TimUntersberger/neogit
:cmd :Neogit
+ :config true
:dependencies [:nvim-lua/plenary.nvim]
- :config true}
+ :keys [{1 :mn 2 :<cmd>Neogit<cr> :desc :Neogit}]
+}
diff --git a/fnl/plugins/tools/orgmode.fnl b/fnl/plugins/tools/orgmode.fnl
index 99e55be..be96fd7 100644
--- a/fnl/plugins/tools/orgmode.fnl
+++ b/fnl/plugins/tools/orgmode.fnl
@@ -19,6 +19,11 @@
(orgmode.setup opts)))
{1 :nvim-orgmode/orgmode
- :event :BufReadPost
:config (fn []
- (setup))}
+ (setup))
+ :event :BufReadPost
+ :keys [{1 :ga 2 :<cmd>OrgAgendaPrompt<cr> :desc "Open agenda prompt"}
+ {1 :gc 2 :<cmd>OrgCapturePrompt<cr> :desc "Open capture prompt"}
+ {1 :gm
+ 2 "<cmd>Telescope orgmode search_headings theme=dropdown<cr>"
+ :desc "Search headings"}]}
diff --git a/fnl/settings/keymaps.fnl b/fnl/settings/keymaps.fnl
index 04073c8..7c323ea 100644
--- a/fnl/settings/keymaps.fnl
+++ b/fnl/settings/keymaps.fnl
@@ -3,46 +3,47 @@
(local opts {:noremap true :silent true})
(local mappings [;;Remap space as leader key
- ["" :<Space> :<Nop>]
+ ["" :<Space> :<Nop> {}]
;; Normal ;;
;; Better window navigation
- [:n :<C-h> :<C-w>h]
- [:n :<C-j> :<C-w>j]
- [:n :<C-k> :<C-w>k]
- [:n :<C-l> :<C-w>l]
+ [:n :<C-h> :<C-w>h {}]
+ [:n :<C-j> :<C-w>j {}]
+ [:n :<C-k> :<C-w>k {}]
+ [:n :<C-l> :<C-w>l {}]
;; Resize with arrows
- [:n :<C-Up> ":resize -2<CR>"]
- [:n :<C-Down> ":resize +2<CR>"]
- [:n :<C-Left> ":vertical resize -2<CR>"]
- [:n :<C-Right> ":vertical resize +2<CR>"]
+ [:n :<C-Up> ":resize -2<CR>" {}]
+ [:n :<C-Down> ":resize +2<CR>" {}]
+ [:n :<C-Left> ":vertical resize -2<CR>" {}]
+ [:n :<C-Right> ":vertical resize +2<CR>" {}]
;; Visual ;;
;; Stay in indent mode
- [:v "<" :<gv]
- [:v ">" :>gv]
+ [:v "<" :<gv {}]
+ [:v ">" :>gv {}]
;; Visual Block ;;
;; Move text up and down
- [:x :J ":move '>+1<CR>gv-gv"]
- [:x :K ":move '<-2<CR>gv-gv"]
+ [:x :J ":move '>+1<CR>gv-gv" {}]
+ [:x :K ":move '<-2<CR>gv-gv" {}]
;; Move text up and down
- [:v :<m-j> ":m .+1<CR>=="]
- [:v :<m-k> ":m .-2<CR>=="]
- [:v :p "\"_dP"]
+ [:v :<m-j> ":m .+1<CR>==" {}]
+ [:v :<m-k> ":m .-2<CR>==" {}]
+ [:v :p "\"_dP" {}]
;; Splits
- [:n :<m-s> :<cmd>split<CR>]
- [:n :<m-t> :<cmd>vsplit<CR>]
+ [:n :<m-s> :<cmd>split<CR> {}]
+ [:n :<m-t> :<cmd>vsplit<CR> {}]
;; Buf navigation
- [:n :<m-m> :<cmd>bprev<CR>]
- [:n :<m-i> :<cmd>bnext<CR>]
- ;; Jump half a page and centralize the view
- [:n :<c-d> :<c-d>zz]
- [:n :<c-u> :<c-u>zz]
+ [:n :<m-m> :<cmd>bprev<CR> {}]
+ [:n :<m-i> :<cmd>bnext<CR> {}]
+ ;; Jump half a page and centralize the view
+ [:n :<c-d> :<c-d>zz {}]
+ [:n :<c-u> :<c-u>zz {}]
;; Remove highlighted search
- [:n :<m-n> :<cmd>nohlsearch<CR>]
+ [:n :<m-n> :<cmd>nohlsearch<CR> {}]
;; Close window
- [:n :Q "<cmd>:q<CR>"]
+ [:n :Q "<cmd>:q<CR>" {}]
;; Force refresh
- [:n :mj "<cmd>:e<CR>"]])
+ [:n :mj "<cmd>:e<CR>" {:desc :Refresh}]])
(each [_ mapping (ipairs mappings)]
(match mapping
- [mode key cmd] (vim.api.nvim_set_keymap mode key cmd opts)))
+ [mode key cmd desc]
+ (vim.api.nvim_set_keymap mode key cmd (vim.tbl_extend :force opts desc))))