diff --git a/lua/lib/state.lua b/lua/lib/state.lua index 08353c07..1ac48c64 100644 --- a/lua/lib/state.lua +++ b/lua/lib/state.lua @@ -11,6 +11,10 @@ function M.set_root_path(path) ROOT_PATH = path end +function M.get_root_path() + return ROOT_PATH +end + local Tree = {} local IGNORE_LIST = "" diff --git a/lua/tree.lua b/lua/tree.lua index c96551e7..6890254a 100644 --- a/lua/tree.lua +++ b/lua/tree.lua @@ -158,6 +158,9 @@ function M.navigate_to_buffer_dir(bufname) if new_path ~= '/' then new_path = new_path .. '/' end + if new_path == state.get_root_path() then + return + end set_root_path(new_path) init_tree() end