;; Custom keymappings. (local opts {:noremap true :silent true}) (local mappings [;;Remap space as leader key ["" : :] ;; Normal ;; ;; Better window navigation [:n : :h] [:n : :j] [:n : :k] [:n : :l] ;; Resize with arrows [:n : ":resize -2"] [:n : ":resize +2"] [:n : ":vertical resize -2"] [:n : ":vertical resize +2"] ;; Visual ;; ;; Stay in indent mode [:v "<" :" :>gv] ;; Visual Block ;; ;; Move text up and down [:x :J ":move '>+1gv-gv"] [:x :K ":move '<-2gv-gv"] ;; Move text up and down [:v : ":m .+1=="] [:v : ":m .-2=="] [:v :p "\"_dP"] ;; Splits [:n : :split] [:n : :vsplit] ;; Buf navigation [:n : :bprev] [:n : :bnext] ;; Jump half a page and centralize the view [:n : :zz] [:n : :zz] ;; Remove highlighted search [:n : :nohlsearch] ;; Close window [:n :Q ":q"] ;; Force refresh [:n :mj ":e"]]) (each [_ mapping (ipairs mappings)] (match mapping [mode key cmd] (vim.api.nvim_set_keymap mode key cmd opts)))