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