Skip to content

Commit 874ae6e

Browse files
fix: reload tree on BufEnter if cwd is different (#2527)
Co-authored-by: Alexander Courtis <[email protected]>
1 parent 74ddb8f commit 874ae6e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lua/nvim-tree.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ local function setup_autocommands(opts)
283283
create_nvim_tree_autocmd("BufEnter", {
284284
pattern = "NvimTree_*",
285285
callback = function()
286-
if opts.reload_on_bufenter and not opts.filesystem_watchers.enable then
287-
if utils.is_nvim_tree_buf(0) then
286+
if utils.is_nvim_tree_buf(0) then
287+
if vim.fn.getcwd() ~= core.get_cwd() or (opts.reload_on_bufenter and not opts.filesystem_watchers.enable) then
288288
reloaders.reload_explorer()
289289
end
290290
end

0 commit comments

Comments
 (0)