Add dir_up function to expose navigating up one directory

This commit is contained in:
Joel D. Elkins
2021-01-07 14:33:14 -06:00
committed by Kiyan
parent 86944b51c0
commit 361e20ecfa

View File

@@ -105,6 +105,19 @@ function M.on_keypress(mode)
end
end
function M.dir_up()
local node = lib.get_node_at_cursor()
if not node then
return lib.change_dir('..')
else
local newdir = vim.fn.fnamemodify(node.absolute_path, ':h')
if newdir == lib.Tree.cwd then
lib.change_dir('..')
end
lib.set_index_and_redraw(newdir)
end
end
function M.refresh()
lib.refresh_tree()
end