Files
yadm/.config/nvim/lua/core/mappings.lua
2024-02-26 12:51:21 +01:00

29 lines
1.1 KiB
Lua

local map = vim.keymap.set
local default_options = { noremap = true, silent = true }
--local expr_options = { noremap = true, expr = true, silent = true }
-- space one line, home,end globally increase/decrease
map('n', '<Home>', 'zc', default_options)
map('n', '<End>', 'zo', default_options)
map('t', '<ESC><ESC>', '<C-\\><C-n>', default_options)
map('i', 'jj', '<ESC>', default_options)
map('i', 'jk', '<ESC>', default_options)
--map('i', ':w<CR>', '<Esc>:w<CR>', default_options)
map('n', 'Q', '<cmd>q<CR>', default_options)
-- Reselect visual block after incrementing/decrementing
map('v', '<c-a>', '<c-a>gv', default_options)
map('v', '<c-x>', '<c-x>gv', default_options)
map('n', '<leader>y', '"_y', default_options)
map('n', '<leader>d', '"_d', default_options)
map('v', '<leader>p', '"_p', default_options)
map('v', 'p', '"_dp', default_options)
map('v', 'P', '"_dP', default_options)
map('n', '<leader>2', '<cmd>set tabstop=2 softtabstop=2 shiftwidth=2<cr>', default_options)
map('n', '<leader>4', '<cmd>set tabstop=4 softtabstop=4 shiftwidth=4<cr>', default_options)
map('n', '<leader>8', '<cmd>set tabstop=8 softtabstop=8 shiftwidth=8<cr>', default_options)