vim.g.mapleader = ' ' vim.keymap.set('n', 's', ':update :source') vim.keymap.set('n', 'x', ':!chmod +x %', { silent = true }) vim.keymap.set({'n', 'v', 'x'}, 'h', 'h') vim.keymap.set({'n', 'v', 'x'}, 'j', 'j') vim.keymap.set({'n', 'v', 'x'}, 'k', 'k') vim.keymap.set({'n', 'v', 'x'}, 'l', 'l') vim.keymap.set('n', 'w', ':write') vim.keymap.set('n', 'q', ':quit') -- 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', 'x'}, 'p', [["+p]]) vim.keymap.set({'n', 'v', 'x'}, 'P', [["+P]]) -- Move selected text to the black hole register & replace with copied text. vim.keymap.set('x', 'v', [["_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', 'yy', [["+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', '') -- Perform a search and replace operation using the word under the cursor vim.keymap.set('n', 'sr', [[:%s/\<\>//gI]])