Skip to content

Commit

Permalink
fix: use buf_is_valid for both delete and wipeout in bufdelete
Browse files Browse the repository at this point in the history
  • Loading branch information
willothy committed Oct 3, 2023
1 parent 52e050a commit 999a483
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lua/cokeline/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,11 @@ local function buf_del_impl(bufnr, focus_next, wipeout, force)
vim.api.nvim_win_set_buf(win, switch_target)
end

if wipeout then
if vim.api.nvim_buf_is_valid(bufnr) then
if vim.api.nvim_buf_is_valid(bufnr) then
if wipeout then
vim.cmd.bwipeout({ count = bufnr })
end
else
if vim.api.nvim_buf_is_loaded(bufnr) then
vim.api.nvim_buf_delete(bufnr, {
force = force,
})
else
vim.api.nvim_buf_delete(bufnr, { force = force })
end
end
end
Expand Down

0 comments on commit 999a483

Please sign in to comment.