Lua/Neovim port of https://github.com/vim-scripts/BufOnly.vim with some changes
Delete all the buffers except the current, not modified and modifiable buffer.
- Neovim 0.5
- With packer.nvim
use { "numtostr/BufOnly.nvim", "cmd": "BufOnly" }- With vim-plug
Plug 'numtostr/BufOnly.nvim', { 'on': 'BufOnly' }:BufOnly
- Delete non modifiable buffer like NERD_tree,
falseby default
vim.g.bufonly_delete_non_modifiable = truevim.fn.nvim_set_keymap('n', '<leader>x', ':BufOnly<CR>', { noremap = true, silent = true })