41 lines
2.0 KiB
Lua
41 lines
2.0 KiB
Lua
vim.g.mapleader = ' '
|
|
vim.keymap.set('n', '<leader><leader>s', ':update<CR> :source<CR>')
|
|
vim.keymap.set('n', '<leader><leader>x', ':!chmod +x %<CR>', { silent = true })
|
|
vim.keymap.set({'n', 'v', 'x'}, '<leader>h', '<C-w>h')
|
|
vim.keymap.set({'n', 'v', 'x'}, '<leader>j', '<C-w>j')
|
|
vim.keymap.set({'n', 'v', 'x'}, '<leader>k', '<C-w>k')
|
|
vim.keymap.set({'n', 'v', 'x'}, '<leader>l', '<C-w>l')
|
|
vim.keymap.set('n', '<leader>w', ':write<CR>')
|
|
vim.keymap.set('n', '<leader>q', ':quit<CR>')
|
|
-- Move the selected lines up or down one line and reselect
|
|
vim.keymap.set('v', 'J', ':m \'>+1<CR>gv=gv')
|
|
vim.keymap.set('v', 'K', ':m \'<-2<CR>gv=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', '<C-d>', '<C-d>zz')
|
|
vim.keymap.set('n', '<C-u>', '<C-u>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'}, '<leader>p', [["+p]])
|
|
vim.keymap.set({'n', 'v', 'x'}, '<leader>P', [["+P]])
|
|
-- Move selected text to the black hole register & replace with copied text.
|
|
vim.keymap.set('x', '<leader>v', [["_dP]])
|
|
-- Yank (copy) the selection to the system clipboard
|
|
vim.keymap.set({'n', 'v'}, '<leader>y', [["+y]])
|
|
-- Yank (copy) the entire buffer to the system clipboard
|
|
vim.keymap.set('n', '<leader>yy', [["+Y]])
|
|
-- Yank all the text in the file to the system clipboard
|
|
vim.keymap.set('n', '<leader>YY', 'gg"+yG')
|
|
-- Delete the selection without yanking (copying) it
|
|
vim.keymap.set({'n', 'v'}, '<leader>d', [["_d]])
|
|
-- Delete the line without yanking (copying) it
|
|
vim.keymap.set('n', '<leader>dd', [["_dd]])
|
|
-- Map Q in Normal mode to do nothing (nop)
|
|
vim.keymap.set('n', 'Q', '<nop>')
|
|
-- Perform a search and replace operation using the word under the cursor
|
|
vim.keymap.set('n', '<leader>sr', [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|