Skip to content

Commit 0babcb4

Browse files
committed
fix: remove buffer when its empty when hijacking
1 parent 8eed3ff commit 0babcb4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lua/nvim-tree.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,11 @@ function M.open_on_directory()
302302
local buf = api.nvim_get_current_buf()
303303
local bufname = api.nvim_buf_get_name(buf)
304304
if vim.fn.isdirectory(bufname) ~= 1 then
305+
if bufname == "" then
306+
vim.schedule(function()
307+
vim.api.nvim_buf_delete(buf, { force = true })
308+
end)
309+
end
305310
return
306311
end
307312

0 commit comments

Comments
 (0)