-- [[ keys.lua ]] local map = vim.api.nvim_set_keymap -- Remap pane splitting map('n', '_', ':split', {silent = true,}) map('n', '|', ':vsplit', {silent = true,}) -- Enable Ctrl+ to switch panes. I map Capslock to Ctrl so this is convenient. map('n', '', 'h', {silent = true,}) map('n', '', 'j', {silent = true,}) map('n', '', 'k', {silent = true,}) map('n', '', 'l', {silent = true,}) -- Use Ctrl+Arrow to resize a pane. Convenient for me, since I never use arrows for movement. map('n', '', ':vertical resize +3', {silent = true,}) map('n', '', ':vertical resize -3', {silent = true,}) map('n', '', ':resize -3', {silent = true,}) map('n', '', ':resize +3', {silent = true,}) -- Disable q: for command history - I rarely use it purposefully and mostly by accident when quitting map('n', 'q:', '', {noremap = true, silent = true,}) -- Remap folding to be more sane -- -- Map 'f' to toggle the fold under cursor vim.keymap.set('n', 'f', 'za', {noremap = true,}) -- Map 'Shift+f' (capital F) to toggle all folds open/closed vim.keymap.set('n', 'F', function() if vim.w.folds_open then vim.opt_local.foldlevel = 0 vim.w.folds_open = false else vim.opt_local.foldlevel = 99 vim.w.folds_open = true end end, {noremap = true,})