-- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` -- Clear highlights on search when pressing in normal mode vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic keymaps vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) -- Toggle spell check vim.keymap.set('n', 'ts', function() vim.o.spell = not vim.o.spell print(vim.o.spell and 'Spell check enabled' or 'Spell check disabled') end, { desc = '[T]oggle [S]pell check' }) -- Toggle word wrap vim.keymap.set('n', 'tw', function() vim.o.wrap = not vim.o.wrap vim.cmd 'redraw' print(vim.o.wrap and 'Wrap enabled' or 'Wrap disabled') end, { desc = '[T]oggle [W]rap' }) -- Toggle colorcolumn vim.keymap.set('n', 'tc', function() if vim.wo.colorcolumn == '' then vim.wo.colorcolumn = '80' else vim.wo.colorcolumn = '' end end, { desc = '[T]oggle [C]olorcolumn' }) -- Set colorcolumn to a specific value vim.keymap.set('n', 'cc', function() local col = vim.fn.input 'Set colorcolumn to: ' if col ~= '' then vim.wo.colorcolumn = col vim.bo.textwidth = tonumber(col) or 80 end end, { desc = 'Set [C]olor[c]olumn width' }) -- Toggle textwidth auto-wrapping vim.keymap.set('n', 'tt', function() if vim.bo.textwidth == 0 then local cc = vim.wo.colorcolumn local width = tonumber(cc) or 80 vim.bo.textwidth = width print('Textwidth enabled (' .. width .. ')') else vim.bo.textwidth = 0 print 'Textwidth disabled' end end, { desc = '[T]oggle [T]extwidth auto-wrap' }) -- Exit terminal mode vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- Window navigation vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' })