-- -- Keymaps! Alot of stuff "borrowed" from thePrimeagen -- local map = vim.keymap.set local cmd = vim.cmd vim.g.mapleader = " " -- Make half page jumps stay in the center of screen map("n", "", "zz", { silent = true, desc = "jump half a page up" }) map("n", "", "zz", { silent = true, desc = "jump half a page down" }) map("n", "", "zz", { silent = true, desc = "jump half a page up" }) map("n", "", "zz", { silent = true, desc = "jump half a page down" }) -- Make jump to next search item stay in the center of screen. map("n", "n", "nzzzv", { silent = true, desc = "jump to next search match" }) map("n", "N", "Nzzzv", { silent = true, desc = "jump to previous search match" }) -- Ctrl+s saves the current buffer in normal/insert mode. map({"n", "i"}, "", cmd.w, { desc = "save current buffer" }) -- Move text map("n", "", ":m -2v=", { silent = true, desc = "move current line one line up" }) map("n", "", ":m +1v=", { silent = true, desc = "move current line one line down" }) map("v", "", ":m '<-2gv=gv", { silent = true, desc = "move current selection one line up" }) map("v", "", ":m '>+1gv=gv", { silent = true, desc = "move current selection one line down" }) -- copy/paste map("x", "p", [["_dP]], { silent = true, desc = "Paste over selected text without losing content in \"-register" }) map({"n", "v"}, "y", [["+y]], { desc = "Yank to system clipboard register" }) -- File operations map("n", "fx", "!chmod +x %", { silent = true, desc = "Set execute flag on current file" }) -- buffers map("n", "bn", cmd.bn, { silent = true, desc = "Move to next buffer"}) map("n", "bb", cmd.bp, { silent = true, desc = "Move to previous buffer"}) map("n", "bd", cmd.bd, { silent = true, desc = "Close current buffer"}) -- Indent map('n', "", "v=") map('x', "", "=", { desc = "auto indent selection" }) map("i", "", "", { desc = "delete indent" }) -- Crazy search+replace map("n", "rw", [[:%s/\<\>//gI]], { desc = "search+replace word under cursor" }) map("n", "Q", "")