fix: bufnr is nil when incomplete setup. (#955)

fixes #947
This commit is contained in:
eightpigs 2022-02-11 02:07:59 +08:00 committed by GitHub
parent da59247db9
commit c226eaf0bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -106,6 +106,12 @@ function M.open()
M.set_target_win()
local cwd = vim.fn.getcwd()
if view.View.bufnr == nil then
vim.schedule(function ()
M.open()
end)
return
end
local should_redraw = view.open()
local respect_buf_cwd = vim.g.nvim_tree_respect_buf_cwd or 0