helm/home/profiles/nvim/config/fnl/conf/mappings.fnl
2024-08-25 00:46:03 -07:00

97 lines
3 KiB
Fennel

(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 [:v] ">" ">gv" {:noremap true})
(nvim.keymap [:n] "<space>" "<NOP>" {:noremap true :silent true})
(vim.api.nvim_create_user_command "FTermToggle" (fn [_]
((-> (require :FTerm)
(. :toggle))))
{:bang true})
(nvim.keymap [:t] "<TAB>" "<cmd>:FTermToggle<CR>")
(nvim.keymap [:n] "<TAB>" "<cmd>:FTermToggle<CR>" {:nnoremap true})
(local
normal-map-leader
{"t" [":Neotree toggle<CR>"
"Toggle neo-tree"]
"w" ["<cmd>:w<cr>"
"Write file"]
"q" ["<cmd>:q<cr>"
"Quit"]
"r" [":RainbowParenthesesToggleAll<CR>"
"Toggle Rainbow Parens"]
; Telescope
"f" {:name "Files"
: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
"g" {:name "Git"
"s" [":G<CR>"
"Git Status"]
"f" [":G fetch --all<cr>"
"Git Fetch"]
"b" [":GBranches<cr>"
"Git Branch"]
"p" [":Git! push<cr>"
"Git Push"]
"d" [":GDiff<cr>"
"Git Diff"]
"h" [""
"Commit Hunk under Cursor"]}
; nmap <leader>gl :diffget //3<CR>
; nmap <leader>gh :diffget //2<CR>
; nnoremap <leader>gc :G commit -v -q %:p<CR>
; Buffers
"b" {:name "Buffer"
:a [""
"Buffer Add"]
:q [""
"Buffer Quit"]
:n [""
"Buffer Next"]
:N ["<cmd>:tabp<CR>"
"Buffer Previous"]
:p ["<cmd>:tabp<CR>"
"Buffer Previous"]}
; Search
"s" {:name "Search"
: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
"c" {:name "Code"
: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>"
"Outline"]}
; Kitaab
"z" {:name "Kitaab"}})
(wk.register normal-map-leader {:prefix "<leader>"})