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.
use { "numtostr/BufOnly.nvim", "cmd": "BufOnly" }
Plug 'numtostr/BufOnly.nvim', { 'on': 'BufOnly' }
:BufOnly
false
by defaultvim.g.bufonly_delete_non_modifiable = true
vim.fn.nvim_set_keymap('n', '<leader>x', ':BufOnly<CR>', { noremap = true, silent = true })