-- unmap arrow keys in non-insert modes Map({ 'n', 'v' }, '', '') Map({ 'n', 'v' }, '', '') Map({ 'n', 'v' }, '', '') Map({ 'n', 'v' }, '', '') -- tab management / navigation Map('n', '', 'enew', { desc = 'create a new tab' }) -- for help exiting certain modes Map({ 'n', 'i' }, '', 'nohlsearch', { desc = 'cancel search highlighting and escape' }) Map('t', '', '', { desc = 'exit terminal mode' }) -- window management Map('n', '', 'wincmd s', { desc = 'horizontal split' }) Map('n', '', 'wincmd v', { desc = 'vertical split' }) Map('n', '', 'wincmd h', { desc = 'move focus to the left window' }) Map('n', '', 'wincmd l', { desc = 'move focus to the right window' }) Map('n', '', 'wincmd j', { desc = 'move focus to the lower window' }) Map('n', '', 'wincmd k', { desc = 'move focus to the upper window' }) Map('n', '', 'wincmd H', { desc = 'move window to left' }) Map('n', '', 'wincmd L', { desc = 'move window to right' }) Map('n', '', 'wincmd K', { desc = 'move window to top' }) Map('n', '', 'wincmd J', { desc = 'move window to bottom' }) -- diagnostic / lsp key bindings Map('n', 'K', vim.lsp.buf.hover, { desc = 'symbol hover' }) Map('n', '', vim.lsp.buf.rename, { desc = 'rename symbol' }) Map('n', 'lm', vim.diagnostic.open_float, { desc = 'view line\'s diagnostic messages' }) Map('n', 'q', vim.lsp.buf.code_action, { desc = 'view quickfix list' }) -- smart tabulation Map('i', '', function() local _, col = unpack(vim.api.nvim_win_get_cursor(0)) -- get cursor position local isindent = vim.api.nvim_get_current_line():sub(1, col):match('^%s*$') local tabexpnd = vim.bo.expandtab local tabwidth = vim.bo.shiftwidth > 0 and vim.bo.shiftwidth or vim.bo.tabstop if not tabexpnd and isindent then return '\t' else local spaces = tabwidth - col % tabwidth return string.rep(' ', spaces == 0 and tabwidth or spaces) end end, { expr = true, desc = "smart tabulation" })