Skip to content

Commit f92b7e7

Browse files
committed
fix: hijack current dir when doing :edit .
fixes #756
1 parent 2298b63 commit f92b7e7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lua/nvim-tree.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,14 @@ function M.open_on_directory()
301301
end
302302
local buf = api.nvim_get_current_buf()
303303
local bufname = api.nvim_buf_get_name(buf)
304-
if vim.fn.isdirectory(bufname) ~= 1 or bufname == lib.Tree.cwd then
304+
if vim.fn.isdirectory(bufname) ~= 1 then
305305
return
306306
end
307307

308308
view.close()
309-
310-
lib.change_dir(bufname)
309+
if bufname ~= lib.Tree.cwd then
310+
lib.change_dir(bufname)
311+
end
311312
M.hijack_current_window()
312313

313314
view.open()

0 commit comments

Comments
 (0)