diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 4078acb..1570330 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -45,7 +45,14 @@ vim.keymap.set('n', 'cdh', 'cd ' .. vim.g.base_dir .. '', { des vim.keymap.set('n', 'cdn', 'cd ' .. vim.fn.stdpath 'config' .. '', { desc = '[C]hange [D]irectory to [N]eovim' }) -- Delete current buffer without closing window -vim.keymap.set('n', 'bd', 'bpspbnbd', { desc = '[B]uffer [D]elete' }) +vim.keymap.set('n', 'bd', function() + -- Get current buffer + local buf = vim.api.nvim_get_current_buf() + -- Switch to different buffer + vim.cmd 'bp' + -- Delete saved buffer + vim.api.nvim_buf_delete(buf, {}) +end, { desc = '[B]uffer [D]elete' }) -- Switch to between buffers vim.keymap.set('n', 'bp', 'bp', { desc = '[B]uffer [P]revious' }) vim.keymap.set('n', 'bn', 'bn', { desc = '[B]uffer [N]ext' })