diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2026-10-17 10:40:11 -0700 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2026-10-17 10:40:11 -0700 |
| commit | ea127689e0ae2d39b49004be605e541ff80e2621 (patch) | |
| tree | abbe79e5e37792bd8ebea8f9ac788ff5b8aed704 /.config/nvim/lua/eugenetriguba/keymaps.lua | |
| download | openbsd-dotfiles-ea127689e0ae2d39b49004be605e541ff80e2621.zip | |
Initial Commit
Diffstat (limited to '.config/nvim/lua/eugenetriguba/keymaps.lua')
| -rw-r--r-- | .config/nvim/lua/eugenetriguba/keymaps.lua | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/.config/nvim/lua/eugenetriguba/keymaps.lua b/.config/nvim/lua/eugenetriguba/keymaps.lua new file mode 100644 index 0000000..0954462 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/keymaps.lua @@ -0,0 +1,36 @@ +local map = vim.keymap.set + +-- Create split panes using leader key +map('n', '<leader>sh', ':split<CR>') +map('n', '<leader>sv', ':vsplit<CR>') + +-- Clear highlights on search when pressing <Esc> in normal mode +map('n', '<Esc>', '<cmd>nohlsearch<CR>') + +-- Diagnostic keymaps +map('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) + +-- Cycle through buffers +map('n', '<Tab>', ':bnext<CR>') +map('n', '<S-Tab>', ':bprevious<CR>') + +-- Exit terminal mode in the builtin terminal with a +-- shortcut that is a bit easier to remember. +map('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' }) + +-- Keybinds to make split navigation easier. +-- Use CTRL+<hjkl> to switch between windows +-- +-- See `:help wincmd` for a list of all window commands +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' }) + +-- Delete the current buffer +vim.keymap.set('n', '<leader>bd', '<cmd>bdelete<cr>', { desc = 'Delete current buffer' }) +-- Force delete the current buffer (discard changes) +vim.keymap.set('n', '<leader>bD', '<cmd>bdelete!<cr>', { desc = 'Force delete current buffer' }) +-- Delete all buffers except the current one +vim.keymap.set('n', '<leader>ba', ':%bd|e#<cr>', { desc = 'Delete all other buffers' }) + |