at main 1.6 kB view raw
1-- [[ Basic Keymaps ]] 2-- See `:help vim.keymap.set()` 3 4-- Clear highlights on search when pressing <Esc> in normal mode 5-- See `:help hlsearch` 6vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>') 7 8-- Diagnostic keymaps 9vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) 10 11-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier 12-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which 13-- is not what someone will guess without a bit more experience. 14-- 15-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping 16-- or just use <C-\><C-n> to exit terminal mode 17vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' }) 18 19-- TIP: Disable arrow keys in normal mode 20vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>') 21vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>') 22vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>') 23vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>') 24 25-- Keybinds to make split navigation easier. 26-- Use CTRL+<hjkl> to switch between windows 27-- 28-- See `:help wincmd` for a list of all window commands 29vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' }) 30vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' }) 31vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }) 32vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }) 33 34-- vim: ts=2 sts=2 sw=2 et