Closed lyndhurst closed 2 years ago
Two separate issues would've been better, yes.
One feature that I miss though is the hidden argument that allows to delete or wipe all hidden buffers at once which I find handy sometimes to clean up a session that got messy with a lot of open buffers before saving it again.
How about:
local bdelete = require('bufdelete').bufdelete
local function delete_hidden_buffers()
local hidden_bufs = vim.tbl_filter(function(bufnr)
return vim.fn.getbufinfo(bufnr)[1].hidden == 1
end, vim.api.nvim_list_bufs())
for _, bufnr in ipairs(hidden_bufs) do
bdelete(bufnr)
end
end
vim.api.nvim_create_user_command('BdeleteHidden', delete_hidden_buffers, { bang = true })
In a similar spirit, I have vim-bufonly installed for the only purpose of deleting all open buffers but the current one, I would love to be able to use one plugin only for all my buffer deletion needs.
I think it'd be pretty easy to write up a function to do that as well.
I think it's an unreasonable goal to want to allow every usecase in the plugin. Thankfully Lua exists to allow you to make the plugin suit your usecase. I think adding features like these is a slippery slope that can likely lead to the plugin being more bloated than needed. It's only meant to be a sane replacement to :bdelete
, anything more is overkill, imo.
Hi,
I switched from
close-buffers.nvim
to this plugin a while ago mostly because of its ability to delete unlisted buffers which is life changing when you use sessions as heavily as I do.One feature that I miss though is the
hidden
argument that allows to delete or wipe all hidden buffers at once which I find handy sometimes to clean up a session that got messy with a lot of open buffers before saving it again.In a similar spirit, I have
vim-bufonly
installed for the only purpose of deleting all open buffers but the current one, I would love to be able to use one plugin only for all my buffer deletion needs.I know I am actually requesting two different (but related) features, so tell me if you would rather have me open a separate one. I kind of got shy about posting two issues at once :)
Thank you for your time.