local vim = require("vim") local g = vim.g -- This is a bit silly, but I don't like passing the mode argument g.mapleader = "\\" -- Unmap arrow keys in normal mode to remove bad habits Keymap("n", "", "") Keymap("n", "", "") Keymap("n", "", "") Keymap("n", "", "") -- Tab navigation Keymap("n", "", "gt") Keymap("n", "", "gT") Keymap("n", "", ":tabnew") Keymap("n", "", ":tabmove +") Keymap("n", "", ":tabmove -") Keymap("n", "", ":tabp") Keymap("n", "", ":tabn") Keymap("n", "", ":tabc") -- Buffer navigation Keymap("n", "", ":bn") Keymap("n", "", ":bp") Keymap("n", "", ":bd") -- Set splits navigation to just ALT + hjkl Keymap("n", "", "h") Keymap("n", "", "j") Keymap("n", "", "k") Keymap("n", "", "l") -- Split size adjusting Keymap("n", "", ":vertical resize +3") Keymap("n", "", ":vertical resize -3") Keymap("n", "", ":resize +3") Keymap("n", "", ":resize -3") -- Define some common shortcuts Keymap("n", "", ":w") Keymap("i", "", ":wi") Keymap("n", "", ":undo") Keymap("n", "", ":redo") -- Terminal Keymap("n", "", ":split term://zsh:resize -7i") Keymap("n", "", ":vnew term://zshi") Keymap("n", "", ":tabnew term://zshi") Keymap("t", "", "") -- Use space for folding/unfolding sections Keymap("n", "", "za") Keymap("v", "", "zf") -- Use shift to quickly move 10 lines up/down Keymap("n", "K", "10k") Keymap("n", "J", "10j") -- Enable/Disable auto commenting Keymap("n", "c", ":setlocal formatoptions-=cro") Keymap("n", "C", ":setlocal formatoptions+=cro") -- Don't leave visual mode after indenting Keymap("v", "<", "", ">gv") -- System clipboard copying Keymap("v", "", '"+y') -- Alias replace all Keymap("n", "", ":%s//gI", {silent=false}) -- Stop search highlight with Esc Keymap("n", "", ":noh") -- Start spell-check Keymap("n", "s", ":setlocal spell! spelllang=en_us") -- Run shell check Keymap("n", "p", ":!shellckeck %") -- Compile opened file (using custom script) Keymap("n", "", ":w | !comp %") -- Close all opened buffers Keymap("n", "Q", ":bufdo bdelete") -- Don't set the incredibely annoying mappings that trigger dynamic SQL -- completion with dbext and keeps on freezing vim whenever pressed with -- a message saying that dbext plugin isn't installed -- See :h ft-sql.txt vim.g.omni_sql_no_default_maps = 1