1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 12:00:05 +08:00
SpaceVim/bundle/nvim-tree.lua/lua/nvim-tree/actions/dir-up.lua
2022-05-19 09:03:59 +08:00

17 lines
455 B
Lua

local utils = require "nvim-tree.utils"
local core = require "nvim-tree.core"
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(utils.path_remove_trailing(core.get_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