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,
false
by default
vim.g.bufonly_delete_non_modifiable = true
vim.fn.nvim_set_keymap('n', '<leader>x', ':BufOnly<CR>', { noremap = true, silent = true })