;; Custom keymappings. (local opts {:noremap true :silent true}) (local mappings [;;Remap space as leader key ["" : : {}] ;; Normal ;; ;; Resize with arrows [:n : :+ {}] [:n : :- {}] [:n "" :5< {}] [:n : :5> {}] ;; 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 {}] ;; Force refresh [:n :mj ":e" {:desc :Refresh}]]) (each [_ mapping (ipairs mappings)] (match mapping [mode key cmd desc] (vim.api.nvim_set_keymap mode key cmd (vim.tbl_extend :force opts desc))))