39 lines
1.3 KiB
Lua
39 lines
1.3 KiB
Lua
local opts = { noremap = true, silent = true }
|
|
vim.keymap.set('n', '<space>', 'nil', opts)
|
|
|
|
-- Tabs
|
|
vim.keymap.set('n', '<S-Right>', ':tabnext<CR>', opts)
|
|
vim.keymap.set('n', '<S-Left>', ':tabprevious<CR>', opts)
|
|
-- Split movement
|
|
vim.keymap.set('n', '<A-Up>', ':wincmd k<CR>', opts)
|
|
vim.keymap.set('n', '<A-Down>', ':wincmd j<CR>', opts)
|
|
vim.keymap.set('n', '<A-Left>', ':wincmd h<CR>', opts)
|
|
vim.keymap.set('n', '<A-Right>', ':wincmd l<CR>', opts)
|
|
|
|
vim.keymap.set('n', '<C-S>', ':wa | wshada<CR>')
|
|
|
|
-- Linewrap and jumping
|
|
vim.keymap.set({ 'n', 'x' }, 'k', 'gk', opts)
|
|
vim.keymap.set({ 'n', 'x' }, 'j', 'gj', opts)
|
|
vim.keymap.set({ 'n', 'x' }, '0', 'g0', opts)
|
|
vim.keymap.set({ 'n', 'x' }, '$', 'g$', opts)
|
|
vim.keymap.set({ 'n', 'x' }, '<Up>', 'gk', opts)
|
|
vim.keymap.set({ 'n', 'x' }, '<Down>', 'gj', opts)
|
|
vim.keymap.set({ 'n', 'x' }, '<Home>', 'g<Home>', opts)
|
|
vim.keymap.set({ 'n', 'x' }, '<End>', 'g<End>', opts)
|
|
|
|
vim.keymap.set('x', '<', '<gv')
|
|
vim.keymap.set('x', '>', '>gv')
|
|
|
|
local function hlWord()
|
|
local current_word = vim.call('expand','<cword>')
|
|
vim.fn.setreg('/', "\\<" .. current_word .. "\\>")
|
|
vim.opt.hlsearch = true
|
|
end
|
|
-- Highlight word under cursor
|
|
vim.keymap.set('n', "'", hlWord, { noremap = true, silent = true })
|
|
vim.keymap.set('x', "'", 'y/\\V<C-R>"<CR>N', { noremap = true, silent = true })
|
|
|
|
-- Close Buffer
|
|
vim.keymap.set('n', '<C-w>', ':bd<CR>')
|