begin rebuild of config to separate files
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
local map = vim.keymap.set
|
||||
|
||||
-- Search / UI
|
||||
map('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
|
||||
-- No command-line window (q: q/ q? and <C-f> in the cmdline)
|
||||
map('n', 'q:', '<nop>')
|
||||
map('n', 'q/', '<nop>')
|
||||
map('n', 'q?', '<nop>')
|
||||
map('c', '<C-f>', '<nop>')
|
||||
|
||||
-- Diagnostics
|
||||
map('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
||||
map('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror' })
|
||||
|
||||
-- Terminal
|
||||
map('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
||||
|
||||
-- Window navigation
|
||||
map('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
||||
map('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
||||
map('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||
map('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||
|
||||
-- From ThePrimeagen -------------------------------------------------------------------------
|
||||
map('n', '<leader>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 '>+1<CR>gv=gv", { desc = 'Move selection down' })
|
||||
map('v', 'K', ":m '<-2<CR>gv=gv", { desc = 'Move selection up' })
|
||||
|
||||
-- Keep the cursor where it is / centered
|
||||
map('n', 'J', 'mzJ`z', { desc = 'Join lines, keep cursor' })
|
||||
map('n', '<C-d>', '<C-d>zz', { desc = 'Half page down, centered' })
|
||||
map('n', '<C-u>', '<C-u>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', '<leader>p', [["_dP]], { desc = '[P]aste over selection, keep register' })
|
||||
|
||||
-- Replace the word under the cursor everywhere in the file
|
||||
map('n', '<leader>S', [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]], { desc = '[S]ubstitute word under cursor' })
|
||||
|
||||
-- Ex mode is never what you wanted
|
||||
map('n', 'Q', '<nop>')
|
||||
Reference in New Issue
Block a user