nvim-tree.lua/lua/nvim-tree/actions/dir-up.lua
kiyan ea92e7bf7c refacto: set tree explorer in the global state
also remove the redraw method and use renderer.draw immediately
2022-02-07 22:07:08 +01:00

14 lines
345 B
Lua

local M = {}
function M.fn(node)
if not node or node.name == ".." then
return require'nvim-tree.actions.change-dir'.fn('..')
else
local newdir = vim.fn.fnamemodify(TreeExplorer.cwd, ':h')
require'nvim-tree.actions.change-dir'.fn(newdir)
return require"nvim-tree.actions.find-file".fn(node.absolute_path)
end
end
return M