fix: bo closing other visible buffers
This commit is contained in:
@@ -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("bW", function() pcall(vim.cmd, "bwipeout!") end, "Wipeout!")
|
nmap_leader("bW", function() pcall(vim.cmd, "bwipeout!") end, "Wipeout!")
|
||||||
nmap_leader("bo", function()
|
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
|
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 })
|
pcall(vim.api.nvim_buf_delete, buf, { force = false })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end, "Close all but current")
|
end, "Close all invisible buffers")
|
||||||
|
|
||||||
-- Debug =======================================================================
|
-- Debug =======================================================================
|
||||||
nmap_leader("db", function() require("dap").toggle_breakpoint() end, "Toggle Breakpoint", "dap")
|
nmap_leader("db", function() require("dap").toggle_breakpoint() end, "Toggle Breakpoint", "dap")
|
||||||
|
|||||||
Reference in New Issue
Block a user