nvim/lua/keymap.lua
2023-11-15 23:40:02 +08:00

55 lines
1.4 KiB
Lua

local opt = {noremap = true}
-- base
G.map({
{'n', '<leader>y', '"+y', opt},
{'n', '<leader>p', '"+p', opt},
{'n', '<leader>d', '"+d', opt},
{'v', '<leader>y', '"+y', opt},
{'v', '<leader>p', '"+p', opt},
{'v', '<leader>d', '"+d', opt},
{'n', '<leader>nh', ':nohlsearch<CR>', opt},
{'n', '<leader>rp', ':%s/',opt},
{'v', 'L', '$', opt},
{'v', 'H', '^', opt},
{'n', 'L', '$', opt},
{'n', 'H', '^', opt},
{'v', '>', '>gv', opt},
{'v', '<', '<gv', opt},
{'n', '>', '>>', opt},
{'n', '<', '<<', opt},
{'n', '?', ':set hlsearch<CR>?', opt},
{'n', '/', ':set hlsearch<CR>/', opt},
{'n', '<A-l>', ':tabn<CR>', opt},
{'n', '<A-h>', ':tabp<CR>', opt},
{'n', '<c-j>', '<c-w>j', opt},
{'n', '<c-h>', '<c-w>h', opt},
{'n', '<c-k>', '<c-w>k', opt},
{'n', '<c-l>', '<c-w>l', opt},
{'n', '<c-c>', ':q<CR>', opt},
{'n', '<c-S>', ':w !sudo tee %<CR>', opt},
{'n', '<c-q>', ':q!<CR>', opt},
{'n', '<leader>y', 'ggyG', opt},
{'n', '<leader>p', 'ggpG', opt},
{'n', '<leader>v', 'ggVG', opt},
{'n', '<up>', ':res -5<CR>', opt},
{'n', '<down>', ':res +5<CR>', opt},
{'n', '<left>', ':vertical resize -5<CR>', opt},
{'n', '<right>', ':vertical resize +5<CR>', opt},
})