Skip to content

Commit 31d8e24

Browse files
authored
fix(#2057): update focused file on new terminal (#2060)
* Fixing #2057 * Update change-dir.lua * Fixing error in force_dir_change
1 parent aa99717 commit 31d8e24

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lua/nvim-tree/actions/root/change-dir.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ local function add_profiling_to(f)
6363
end
6464

6565
M.force_dirchange = add_profiling_to(function(foldername, should_open_view)
66-
if should_change_dir() then
66+
local valid_dir = vim.fn.isdirectory(foldername) == 1 -- prevent problems on non existing dirs
67+
if should_change_dir() and valid_dir then
6768
cd(M.options.global, foldername)
69+
core.init(foldername)
6870
end
6971

70-
core.init(foldername)
71-
7272
if should_open_view then
7373
require("nvim-tree.lib").open()
7474
else

0 commit comments

Comments
 (0)