From 874ae6e9445a5eb5ba430e5fd10212450a261ad7 Mon Sep 17 00:00:00 2001 From: Azad <49314270+Akmadan23@users.noreply.github.com> Date: Sun, 12 Nov 2023 03:14:32 +0100 Subject: [PATCH] fix: reload tree on `BufEnter` if cwd is different (#2527) Co-authored-by: Alexander Courtis --- lua/nvim-tree.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index efc26597..d3bdb4a3 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -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