local map = vim.keymap.set -- Search / UI map('n', '', 'nohlsearch') -- No command-line window (q: q/ q? and in the cmdline) map('n', 'q:', '') map('n', 'q/', '') map('n', 'q?', '') map('c', '', '') -- Diagnostics map('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) map('n', 'e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror' }) -- Terminal map('t', '', '', { desc = 'Exit terminal mode' }) -- Window navigation map('n', '', '', { desc = 'Move focus to the left window' }) map('n', '', '', { desc = 'Move focus to the right window' }) map('n', '', '', { desc = 'Move focus to the lower window' }) map('n', '', '', { desc = 'Move focus to the upper window' }) -- From ThePrimeagen ------------------------------------------------------------------------- map('n', 'pv', vim.cmd.Ex, { desc = 'Open netrw (file [P]roject [V]iew)' }) -- Move selected lines up/down, re-indenting as they go map('v', 'J', ":m '>+1gv=gv", { desc = 'Move selection down' }) map('v', 'K', ":m '<-2gv=gv", { desc = 'Move selection up' }) -- Keep the cursor where it is / centered map('n', 'J', 'mzJ`z', { desc = 'Join lines, keep cursor' }) map('n', '', 'zz', { desc = 'Half page down, centered' }) map('n', '', 'zz', { desc = 'Half page up, centered' }) map('n', 'n', 'nzzzv', { desc = 'Next match, centered' }) map('n', 'N', 'Nzzzv', { desc = 'Previous match, centered' }) -- Paste over a selection without losing what you yanked map('x', 'p', [["_dP]], { desc = '[P]aste over selection, keep register' }) -- Replace the word under the cursor everywhere in the file map('n', 'S', [[:%s/\<\>//gI]], { desc = '[S]ubstitute word under cursor' }) -- Ex mode is never what you wanted map('n', 'Q', '')