-- Remaps --------------------------------------------- -- Set leader to space vim.g.mapleader = " " -- Easily get back to Normal mode. vim.keymap.set("i", "", "") -- Move the selected lines up or down one line and reselect vim.keymap.set("v", "J", ":m '>+1gv=gv") vim.keymap.set("v", "K", ":m '<-2gv=gv") -- Join the current line with the line below and reposition the cursor vim.keymap.set("n", "J", "mzJ`z") -- Scroll down or up and reposition the cursor vim.keymap.set("n", "", "zz") vim.keymap.set("n", "", "zz") -- Search forward and reposition the cursor vim.keymap.set("n", "n", "nzzzv") -- Search backward and reposition the cursor vim.keymap.set("n", "N", "Nzzzv") -- Paste the selection from the system clipboard vim.keymap.set({"n", "v"}, "v", [["+p]]) vim.keymap.set({"n", "v"}, "V", [["+P]]) -- Move selected text to the black hole register & replace with copied text. vim.keymap.set("x", "p", [["_dP]]) -- Yank (copy) the selection to the system clipboard vim.keymap.set({"n", "v"}, "y", [["+y]]) -- Yank (copy) the entire buffer to the system clipboard vim.keymap.set("n", "Y", [["+Y]]) -- Yank all the text in the file to the system clipboard vim.keymap.set("n", "YY", "gg\"+yG") -- Delete the selection without yanking (copying) it vim.keymap.set({"n", "v"}, "d", [["_d]]) -- Delete the line without yanking (copying) it vim.keymap.set("n", "dd", [["_dd]]) -- Map Q in Normal mode to do nothing (nop) vim.keymap.set("n", "Q", "") -- Format the current buffer using the language server protocol (LSP) vim.keymap.set("n", "kf", vim.lsp.buf.format) -- Perform a search and replace operation using the word under the cursor vim.keymap.set("n", "sr", [[:%s/\<\>//gI]]) -- Make the current file executable (chmod +x) vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) -- Source the current file vim.keymap.set("n", "", vim.cmd.so) -- Jump to the next location in the quickfix list and reposition the cursor -- vim.keymap.set("n", "", "cnextzz") -- Jump to the previous location in the quickfix list and reposition the cursor -- vim.keymap.set("n", "", "cprevzz") -- Jump to the next location in the location list and reposition the cursor --vim.keymap.set("n", "k", "lnextzz") -- Jump to the previous location in the location list and reposition the cursor --vim.keymap.set("n", "j", "lprevzz")