fix: reload tree on BufEnter if cwd is different (#2527)

Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
Azad 2023-11-12 03:14:32 +01:00 committed by GitHub
parent 74ddb8f2bb
commit 874ae6e944
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -283,8 +283,8 @@ local function setup_autocommands(opts)
create_nvim_tree_autocmd("BufEnter", {
pattern = "NvimTree_*",
callback = function()
if opts.reload_on_bufenter and not opts.filesystem_watchers.enable then
if utils.is_nvim_tree_buf(0) then
if utils.is_nvim_tree_buf(0) then
if vim.fn.getcwd() ~= core.get_cwd() or (opts.reload_on_bufenter and not opts.filesystem_watchers.enable) then
reloaders.reload_explorer()
end
end