fix: bo closing other visible buffers

This commit is contained in:
2026-08-29 21:49:36 +02:00
parent 271e15370c
commit b8ab1caf20
+4 -3
View File
@@ -48,13 +48,14 @@ nmap_leader("bD", function() pcall(vim.cmd, "bdelete!") end, "Delete!")
nmap_leader("bw", function() pcall(vim.cmd, "bwipeout") end, "Wipeout")
nmap_leader("bW", function() pcall(vim.cmd, "bwipeout!") end, "Wipeout!")
nmap_leader("bo", function()
local current = vim.api.nvim_get_current_buf()
local visible = vim.iter(vim.api.nvim_list_wins()):map(vim.api.nvim_win_get_buf):totable()
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
if buf ~= current and vim.api.nvim_buf_is_loaded(buf) and vim.bo[buf].buflisted then
if not vim.list_contains(visible, buf) then
pcall(vim.api.nvim_buf_delete, buf, { force = false })
end
end
end, "Close all but current")
end, "Close all invisible buffers")
-- Debug =======================================================================
nmap_leader("db", function() require("dap").toggle_breakpoint() end, "Toggle Breakpoint", "dap")