(local nvim (require :lib/nvim)) (local wk (require :which-key)) ;; Convenient way to indent stuff in visual mode (nvim.keymap [:v] "<" "" ">gv" {:noremap true}) (nvim.keymap [:n] "" "" {:noremap true :silent true}) ;; Convenient way to move stuff in visual mode (nvim.keymap [:v] "J" ":m '>+1gv=gv" {:noremap true}) (nvim.keymap [:v] "K" ":m '>-2gv=gv" {:noremap true}) ;; Convientent screen shifting (nvim.keymap [:n] "n" "nzzzv" {:noremap true}) (nvim.keymap [:n] "N" "Nzzzv" {:noremap true}) (nvim.keymap [:n] "J" "mzJ'z" {:noremap true}) ; Fix Y (nvim.keymap [:n] "Y" "y$") ; Unmap Q (nvim.keymap [] "Q" "") ; FTerm (vim.api.nvim_create_user_command "FTermToggle" (fn [_] ((-> (require :FTerm) (. :toggle)))) {:bang true}) (nvim.keymap [:t] "" ":FTermToggle") (nvim.keymap [:n] "" ":FTermToggle" {:noremap true}) ; Buffer Movement (nvim.keymap [:n] "gT" ":BufferPrevious" {:silent true :noremap true}) (nvim.keymap [:n] "gt" ":BufferNext" {:silent true :noremap true}) (nvim.keymap [:n] "gj" ":BufferPick" {:silent true :noremap true}) (nvim.keymap [:n] "gb" ":Telescope buffers" {:silent true :noremap true}) (nvim.keymap [:n] "gq" ":BufferClosoe" {:silent true :noremap true}) (local normal-map-leader {"t" [":Neotree toggle" "Toggle neo-tree"] "w" [":w" "Write file"] "q" [":q" "Quit"] "r" [":RainbowParenthesesToggleAll" "Toggle Rainbow Parens"] "u" [":UndotreeToggle" "Toggle Undo Tree"] ; Telescope "f" {:name "Files" :f ["Telescope find_files" "Find Files (in Telescope)"] :g ["Telescope live_grep" "Find Grep (in Telescope)"] :b ["Telescope buffers" "Find Buffers"] :h ["Telescope help_tags" "Find Help"] :t ["Telescope tags" "Find Tags"] :r ["Telescope oldfiles" "Recent files"]} ; Git "g" {:name "Git" "s" [":G" "Git Status"] "f" [":G fetch --all" "Git Fetch"] "b" [":GBranches" "Git Branch"] "p" [":Git! push" "Git Push"] "d" [":GDiff" "Git Diff"] "h" ["" "Commit Hunk under Cursor"]} ; For handling merges ; nmap gl :diffget //3 ; nmap gh :diffget //2 ; nnoremap gc :G commit -v -q %:p ; Buffers "b" {:name "Buffer" :b [":Telescope buffers" "Buffer List"] :q [":BufferClose" "Buffer Quit"] :n [":BufferNext" "Buffer Next"] :N [":tabp" "Buffer Previous"] :p [":tabp" "Buffer Previous"]} ; Search "s" {:name "Search" :b ["Telescope current_buffer_fuzzy_find" "Search in current buffer"] :s ["Telescope live_grep" "Search in project"] :t ["TodoTelescope" "Search TODOs in project"] :c ["let @/ = \"\":echo 'Search highlight cleared'" "Clear search"]} ; Code "c" {:name "Code" :d [":lua vim.lsp.buf.definition()" "Go to Definition"] :i [":lua require('telescope.builtin').lsp_implementation()" "Implementation"] :s [":lua vim.lsp.buf.signature_help()" "Signature Help"] :r [":Lspsaga rename" "Rename Symbol"] :h [":Lspsaga hover_doc" "Hover doc"] :o [":LSoutlineToggle" "Outline"] :t [":call v:lua.toggle_diagnostics()"]} ; Kitaab "z" {:name "Kitaab" :n [":ZettelNew" "Zettel New"]} "v" {:name "Tabs" :v [":vnew" "Vertical Split"] :h [":new" "Horizontal Split"]}}) (wk.register normal-map-leader {:prefix ""})