Skip to content

Commit 4cc2abe

Browse files
committed
fix: reload view when bufnr is not valid
1 parent 802bc08 commit 4cc2abe

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lua/nvim-tree/view.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function M.setup()
131131
for _, opt in ipairs(M.View.bufopts) do
132132
vim.bo[M.View.bufnr][opt.name] = opt.val
133133
end
134-
134+
135135
vim.cmd "augroup NvimTreeView"
136136
vim.cmd "au!"
137137
vim.cmd "au BufWinEnter,BufWinLeave * lua require'nvim-tree.view'._prevent_buffer_override()"
@@ -294,6 +294,10 @@ end
294294

295295
function M.open(options)
296296
options = options or { focus_tree = true }
297+
if not a.nvim_buf_is_valid(M.View.bufnr) then
298+
HAS_LOADED = false
299+
end
300+
297301
if not HAS_LOADED then
298302
M.setup()
299303
HAS_LOADED = true

0 commit comments

Comments
 (0)