28 lines
1.1 KiB
Lua
28 lines
1.1 KiB
Lua
-- Keymaps configuration
|
|
-- See `:help vim.keymap.set()`
|
|
|
|
-- Clear highlights on search when pressing <Esc> in normal mode
|
|
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
|
|
|
-- Diagnostic keymaps
|
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
|
|
|
-- Go to first character in line
|
|
vim.keymap.set('', '<Leader>h', '^')
|
|
|
|
-- Go to last character in line
|
|
vim.keymap.set('', '<Leader>l', 'g_')
|
|
|
|
-- Save all files
|
|
vim.keymap.set('n', '<leader>w', ':wa <CR>')
|
|
|
|
-- Exit terminal mode with easier shortcut
|
|
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
|
|
|
-- Keybinds to make split navigation easier
|
|
-- Use CTRL+<hjkl> to switch between windows
|
|
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
|
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
|
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
|
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|