Add dir_up function to expose navigating up one directory
This commit is contained in:
@@ -105,6 +105,19 @@ function M.on_keypress(mode)
|
|||||||
end
|
end
|
||||||
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()
|
function M.refresh()
|
||||||
lib.refresh_tree()
|
lib.refresh_tree()
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user