vim.keymap.set("i", "jk", "", {}) -- Don't copy "c" changes to primary register vim.keymap.set("n", "c", '"_c', { desc = "Prevent copying to primary register" }) -- Move lines up and down vim.keymap.set("v", "J", ":m '>+1gv=gv") vim.keymap.set("v", "K", ":m '<-2gv=gv") -- Easily open splits vim.keymap.set("n", "bs", "split", { desc = "Open horizontal spilt" }) vim.keymap.set("n", "vs", "vsplit", { desc = "Open vertical spilt" }) -- Spell-check vim.keymap.set("n", "o", function() vim.cmd("setlocal spell! spelllang=en_au") end, { desc = "Toggle spell check" }) -- Map Q to run q macro vim.keymap.set("n", "Q", "@q", { desc = "Remap Q to run @q macro" }) vim.keymap.set("x", "Q", ":norm @q", { desc = "Remap Q to run @q macro" }) -- Keep highlight when indenting vim.keymap.set("v", "<", "", ">gv", { desc = "Keep highlight when indenting" }) vim.keymap.set("n", "tN", "tabnew", { desc = "New tab" }) vim.keymap.set("n", "tn", "tabnext", { desc = "Next tab" }) vim.keymap.set("n", "tp", "tabprevious", { desc = "Previous tab" }) vim.keymap.set("x", "p", '"_dP', { desc = "Delete into black hole register" }) vim.keymap.set("n", "d", '"_d', { desc = "Delete into black hole register" }) vim.keymap.set("v", "d", '"_d', { desc = "Delete into black hole register" }) -- Keep page scroll centered vim.keymap.set("n", "", "zz", { desc = "Scroll down half page" }) vim.keymap.set("n", "", "zz", { desc = "Scroll up half page" }) -- Keep cursor centered vim.keymap.set("n", "n", "nzzzv", { desc = "Next search result" }) vim.keymap.set("n", "N", "Nzzzv", { desc = "Previous search result" }) -- Keep cursor centered when jumping through quickfix list vim.keymap.set("n", "K", "cprevzz", { desc = "Previous item in quickfix list" }) vim.keymap.set("n", "J", "cnextzz", { desc = "Next item in quickfix list" }) -- Easily run global search and replace vim.keymap.set( "n", "rr", [[:%s/\<\>//gI]], { desc = "Search and replace for word under cursor" } ) vim.keymap.set("t", "", "", { silent = true })