From 0860db73ae6fd9a6f6347219d820bf026a6b8b91 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Sun, 27 Sep 2026 17:38:39 +0200 Subject: * MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated-commit-by: dots Signed-off-by: Robert Günzler --- .config/nvim/lua/config/keymaps.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to '.config/nvim/lua/config/keymaps.lua') diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua index a93b8fd..3c51041 100644 --- a/.config/nvim/lua/config/keymaps.lua +++ b/.config/nvim/lua/config/keymaps.lua @@ -1,7 +1,12 @@ local map = vim.keymap.set -map('n', 'gb', 'bnext', { desc = 'Buffer next' }) -map('n', 'gB', 'bprevious', { desc = 'Buffer prev' }) +map('n', 'gb', 'bnext', { desc = 'Buf next' }) +map('n', 'gB', 'bprevious', { desc = 'Buf prev' }) + +map('n', '', 'tabprev', { desc = 'Tab prev' }) +map('n', '', 'bprev', { desc = 'Buf prev' }) +map('n', '', 'bnext', { desc = 'Buf next' }) +map('n', '', 'tabnext', { desc = 'Tab next' }) map('n', '', 'cnext', { desc = 'Quickfix next' }) map('n', '', 'cprev', { desc = 'Quickfix prev' }) @@ -21,8 +26,11 @@ map( vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, { group = vim.api.nvim_create_augroup('bufclose', {}), callback = function() - if vim.list_contains({ 'help', 'nofile', 'quickfix' }, vim.bo.buftype) then - map('', 'q', 'close', { desc = 'Close buffer', buffer = 0 }) + if + (vim.fn.maparg('q', 'n') == '') + and vim.list_contains({ 'help', 'nofile', 'nowrite', 'quickfix' }, vim.bo.buftype) + then + map('n', 'q', 'close', { desc = 'Close buffer', buffer = 0 }) end end, }) -- cgit 1.4.1