A neovim plugin to cycle through recently used order and reopen recently closed buffers.
BufStackList, BufClosedList).BufStackNext, BufStackPrev).BufReopen).BufStackClear, BufClosedClear, BufClear).Using lazy.nvim:
return {
'BibekBhusal0/bufstack.nvim',
dependencies = {
'MunifTanjim/nui.nvim', -- required if you want to use menu
'nvim-lua/plenary.nvim' -- required to shorten path
},
opts = {
max_tracked = 16,
shorten_path = true
}
}
require('bufstack').setup({
max_tracked = 16, -- Default: 16
shorten_path = true, -- Default: false
})
BufStack: Tracks the current buffer.BufStackNext: Navigates to the next tracked buffer.BufStackPrev: Navigates to the previous tracked buffer.BufStackList: Lists tracked buffers in a menu.BufClosedList: Lists recently closed buffers in a menu.BufReopen: Reopens the last closed buffer.BufStackClear: Clears the list of tracked buffers.BufClosedClear: Clears the list of closed buffers.BufClear: Clears both tracked and closed buffers lists.vim.keymap.set('n', '<leader>bn', '<Cmd>BufStackNext<CR>')
vim.keymap.set('n', '<leader>bp', '<Cmd>BufStackPrev<CR>')
vim.keymap.set('n', '<leader>bl', '<Cmd>BufStackList<CR>')
vim.keymap.set('n', '<leader>br', '<Cmd>BufReopen<CR>')
Menu of tracked buffer and recently closed buffers can be opened with commands BufStackList and BufClosedList respectively.
Keymaps in the menu are:
MIT