2022-04-05 19:57:44 +00:00
|
|
|
(let [mod {}
|
|
|
|
keymap vim.keymap
|
2022-04-09 23:07:36 +00:00
|
|
|
substitute (require :substitute)
|
2022-04-05 19:57:44 +00:00
|
|
|
telescope-builtin (require :telescope.builtin)
|
|
|
|
telescope-themes (require :telescope.themes)
|
|
|
|
telescope-nifoc (require :nifoc.telescope)
|
|
|
|
telescope-ivy (telescope-themes.get_ivy)
|
|
|
|
telescope-dropdown (telescope-themes.get_dropdown)
|
2022-04-20 14:27:26 +00:00
|
|
|
gitsigns (require :gitsigns)
|
2022-04-23 18:51:50 +00:00
|
|
|
repl (require :nifoc.repl)
|
2022-09-22 20:35:10 +00:00
|
|
|
formatting (require :nifoc.formatting)]
|
2022-04-05 19:57:44 +00:00
|
|
|
(fn mod.setup []
|
|
|
|
(keymap.set :n :<space> :<nop> {:noremap true})
|
2022-04-23 18:51:50 +00:00
|
|
|
;; Leader Mappings
|
2022-06-12 21:06:29 +00:00
|
|
|
(keymap.set :n :<leader>o telescope-nifoc.find-files {:desc "Find Files"})
|
2022-04-23 18:51:50 +00:00
|
|
|
(keymap.set :n :<leader>s #(telescope-builtin.live_grep telescope-ivy)
|
|
|
|
{:desc "Live Grep"})
|
|
|
|
(keymap.set :n :<leader>fn :<cmd>enew<CR> {:desc "New File"})
|
2023-06-27 18:26:17 +00:00
|
|
|
(keymap.set :n :<leader>u "<cmd>UrlView buffer<CR>" {:desc "Open UrlView"})
|
2022-12-20 19:26:57 +00:00
|
|
|
(keymap.set :n :<leader>ut "<cmd>Telescope undo<CR>"
|
2022-04-23 18:51:50 +00:00
|
|
|
{:desc "Toggle Undotree"})
|
2023-10-15 20:08:36 +00:00
|
|
|
(keymap.set :n :<leader>c repl.open-shell {:desc "Open Shell"})
|
|
|
|
(keymap.set :n :<leader>r repl.open-repl {:desc "Open REPL"})
|
2022-04-23 18:51:50 +00:00
|
|
|
(keymap.set :n :<leader>bl #(telescope-builtin.buffers telescope-dropdown)
|
|
|
|
{:desc "List Buffers"})
|
|
|
|
(keymap.set :n :<leader>bf
|
|
|
|
#(telescope-builtin.current_buffer_fuzzy_find telescope-dropdown)
|
|
|
|
{:desc "Find In Buffer"})
|
|
|
|
(keymap.set :n :<leader>bt
|
|
|
|
#(telescope-builtin.treesitter telescope-dropdown)
|
|
|
|
{:desc "Find via Treesitter"})
|
|
|
|
(keymap.set :n :<leader>pt :<cmd>TodoTelescope<CR> {:desc "TODO Comments"})
|
|
|
|
(keymap.set :n :<leader>vs #(telescope-builtin.git_status telescope-ivy)
|
|
|
|
{:desc "VCS Status"})
|
|
|
|
(keymap.set :n :<leader>vb
|
|
|
|
#(telescope-builtin.git_branches telescope-dropdown)
|
|
|
|
{:desc "List VCS Branches"})
|
2023-01-14 16:07:11 +00:00
|
|
|
(keymap.set :n :<leader>vl #(gitsigns.blame_line {:full true})
|
|
|
|
{:desc "Blame Line"})
|
2022-04-23 18:51:50 +00:00
|
|
|
(keymap.set :n :<leader>lk telescope-builtin.keymaps
|
|
|
|
{:desc "Show Keymappings"})
|
|
|
|
(keymap.set :n :<leader>ld #(telescope-builtin.diagnostics telescope-ivy)
|
|
|
|
{:desc "Show Diagnostics"})
|
|
|
|
(keymap.set :n :<leader>dli :<cmd>LspInfo<CR> {:desc "LSP Info"})
|
|
|
|
(keymap.set :n :<leader>dlr :<cmd>LspRestart<CR> {:desc "Restart LSP"})
|
2023-01-11 22:48:51 +00:00
|
|
|
(keymap.set :n :<leader>ds #(vim.diagnostic.open_float {:scope :line})
|
|
|
|
{:desc "Show Diagnostics"})
|
2022-11-11 14:06:11 +00:00
|
|
|
(keymap.set :n :<leader>dtp :<cmd>TSPlaygroundToggle<CR>
|
2022-04-23 18:51:50 +00:00
|
|
|
{:desc "Toggle Treetsitter Playground"})
|
2022-04-05 19:57:44 +00:00
|
|
|
;; Other Mappings
|
2023-10-09 19:59:19 +00:00
|
|
|
(keymap.set :n :F #(formatting.maybe-format-buffer 0) {:desc "Format Buffer"})
|
2022-04-23 18:51:50 +00:00
|
|
|
(keymap.set :n :<A-Left> :b)
|
|
|
|
(keymap.set :n :<A-Right> :w)
|
|
|
|
(keymap.set :n :<S-Left> "^")
|
|
|
|
(keymap.set :n :<S-Right> "$")
|
|
|
|
(keymap.set :i :<A-Left> :<C-o>b)
|
|
|
|
(keymap.set :i :<A-Right> :<C-o>w)
|
|
|
|
(keymap.set :i :<S-Left> :<C-o>^)
|
|
|
|
(keymap.set :i :<S-Right> :<C-o>$)
|
2022-04-09 23:07:36 +00:00
|
|
|
(keymap.set :n :p "<Plug>(YankyPutAfter)")
|
|
|
|
(keymap.set :n :P "<Plug>(YankyPutBefore)")
|
|
|
|
(keymap.set :x :p substitute.visual)
|
|
|
|
(keymap.set :x :P "<Plug>(YankyPutBefore)")
|
|
|
|
(keymap.set :n :gp "<Plug>(YankyGPutAfter)")
|
|
|
|
(keymap.set :n :gP "<Plug>(YankyGPutBefore)")
|
|
|
|
(keymap.set :x :gp "<Plug>(YankyGPutAfter)")
|
|
|
|
(keymap.set :x :gP "<Plug>(YankyGPutBefore)")
|
|
|
|
(keymap.set :n :y "<Plug>(YankyYank)")
|
2022-04-17 19:44:56 +00:00
|
|
|
(keymap.set :x :y "<Plug>(YankyYank)"))
|
2022-04-05 19:57:44 +00:00
|
|
|
|
|
|
|
(fn mod.lsp-attach [client bufnr]
|
2022-04-23 18:51:50 +00:00
|
|
|
(keymap.set :n :<leader>t
|
|
|
|
#(telescope-builtin.lsp_document_symbols telescope-dropdown)
|
|
|
|
{:buffer bufnr :desc "LSP Document Symbols"})
|
2022-04-23 22:15:57 +00:00
|
|
|
(keymap.set :n :<leader>tw
|
|
|
|
#(telescope-builtin.lsp_dynamic_workspace_symbols telescope-dropdown)
|
|
|
|
{:buffer bufnr :desc "LSP Workspace Symbols"})
|
2023-07-05 21:55:20 +00:00
|
|
|
(keymap.set :n :<leader>th #(vim.lsp.inlay_hint bufnr nil)
|
2023-06-26 11:07:19 +00:00
|
|
|
{:buffer bufnr :desc "Toggle Inlay Hints"})
|
2022-04-23 18:51:50 +00:00
|
|
|
(keymap.set :n :<leader>lca
|
|
|
|
#(telescope-builtin.lsp_code_actions telescope-dropdown)
|
|
|
|
{:buffer bufnr :desc "LSP Code Action"})
|
|
|
|
(keymap.set :n :<leader>lfr
|
|
|
|
#(telescope-builtin.lsp_references telescope-dropdown)
|
|
|
|
{:buffer bufnr :desc "Find References"})
|
|
|
|
(keymap.set :n :<leader>lfd
|
|
|
|
#(telescope-builtin.lsp_definitions telescope-dropdown)
|
|
|
|
{:buffer bufnr :desc "Find Definitions"})
|
|
|
|
(keymap.set :n :<leader>lfi
|
|
|
|
#(telescope-builtin.lsp_implementations telescope-dropdown)
|
|
|
|
{:buffer bufnr :desc "Find Implementations"})
|
|
|
|
(keymap.set :n :K vim.lsp.buf.hover
|
2022-09-22 20:34:18 +00:00
|
|
|
{:buffer bufnr :desc "Show Documentation"}))
|
2022-04-05 19:57:44 +00:00
|
|
|
|
2022-04-20 14:27:26 +00:00
|
|
|
(fn mod.terminal-open [bufnr]
|
2022-04-23 18:51:50 +00:00
|
|
|
(let [map-opts {:buffer bufnr}]
|
2022-04-20 14:27:26 +00:00
|
|
|
(keymap.set :t :<esc> "<C-\\><C-n>" map-opts)
|
|
|
|
(keymap.set :t :<C-h> "<C-\\><C-n><C-W>h" map-opts)
|
|
|
|
(keymap.set :t :<C-j> "<C-\\><C-n><C-W>j" map-opts)
|
|
|
|
(keymap.set :t :<C-k> "<C-\\><C-n><C-W>k" map-opts)
|
|
|
|
(keymap.set :t :<C-l> "<C-\\><C-n><C-W>l" map-opts)))
|
|
|
|
|
2022-04-05 19:57:44 +00:00
|
|
|
mod)
|