-- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` -- Set highlight on search, but clear on pressing in normal mode vim.opt.hlsearch = true vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic keymaps ---@diagnostic disable-next-line: deprecated vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' }) ---@diagnostic disable-next-line: deprecated vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' }) vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' }) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) vim.keymap.set('n', 'l', 'Lazy', { desc = 'Lazy plugin manager' }) vim.keymap.set('n', '1', '!!', { desc = 'Run last command' }) -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier -- for people to discover. Otherwise, you normally need to press , which -- is not what someone will guess without a bit more experience. -- -- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping -- or just use to exit terminal mode vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode vim.keymap.set('n', '', 'echo "Use h to move!!"') vim.keymap.set('n', '', 'echo "Use l to move!!"') vim.keymap.set('n', '', 'echo "Use k to move!!"') vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Resize windows vim.keymap.set('n', '', 'resize +2', { desc = 'Increase Window Height' }) vim.keymap.set('n', '', 'resize -2', { desc = 'Decrease Window Height' }) vim.keymap.set('n', '', 'vertical resize -2', { desc = 'Decrease Window Width' }) vim.keymap.set('n', '', 'vertical resize +2', { desc = 'Increase Window Width' }) vim.keymap.set('n', '', 'wincmd =', { desc = 'Set height/width equal' }) -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows -- -- See `:help wincmd` for a list of all window commands 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' }) -- Move Lines vim.keymap.set('n', '', 'm .+1==', { desc = 'Move Down' }) vim.keymap.set('n', '', 'm .-2==', { desc = 'Move Up' }) vim.keymap.set('i', '', 'm .+1==gi', { desc = 'Move Down' }) vim.keymap.set('i', '', 'm .-2==gi', { desc = 'Move Up' }) vim.keymap.set('v', '', ":m '>+1gv=gv", { desc = 'Move Down' }) vim.keymap.set('v', '', ":m '<-2gv=gv", { desc = 'Move Up' }) -- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n vim.keymap.set('n', 'n', "'Nn'[v:searchforward].'zv'", { expr = true, desc = 'Next Search Result' }) vim.keymap.set('x', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next Search Result' }) vim.keymap.set('o', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next Search Result' }) vim.keymap.set('n', 'N', "'nN'[v:searchforward].'zv'", { expr = true, desc = 'Prev Search Result' }) vim.keymap.set('x', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev Search Result' }) vim.keymap.set('o', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev Search Result' }) -- Buffers vim.keymap.set('n', '', 'bprevious', { desc = 'Prev Buffer' }) vim.keymap.set('n', '', 'bnext', { desc = 'Next Buffer' }) vim.keymap.set('n', 'bb', 'e #', { desc = 'Switch to Other Buffer' }) vim.keymap.set('n', 'bD', ':bd', { desc = 'Delete Buffer and Window' }) -- Tabs vim.keymap.set('n', 'l', 'tablast', { desc = 'Last Tab' }) vim.keymap.set('n', 'o', 'tabonly', { desc = 'Close Other Tabs' }) vim.keymap.set('n', 'f', 'tabfirst', { desc = 'First Tab' }) vim.keymap.set('n', '', 'tabnew', { desc = 'New Tab' }) vim.keymap.set('n', 'd', 'tabclose', { desc = 'Close Tab' }) vim.keymap.set('n', ']', 'tabnext', { desc = 'Next Tab' }) vim.keymap.set('n', '[', 'tabprevious', { desc = 'Previous Tab' }) -- Toggle LLM Suggestions vim.keymap.set('n', 'tt', function() local cp = require 'copilot.suggestion' cp.toggle_auto_trigger() if vim.b.copilot_suggestion_auto_trigger then vim.notify 'Suggestions Enabled' else vim.notify 'Suggestions Disabled' end end, { desc = '[T]oggle LLM Suggestion Auto-[T]rigger' }) -- vim: ts=2 sts=2 sw=2 et