refactor(actions): move actions into semantic modules (#1410)
This commit is contained in:
16
lua/nvim-tree/actions/root/dir-up.lua
Normal file
16
lua/nvim-tree/actions/root/dir-up.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
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.root.change-dir").fn ".."
|
||||
else
|
||||
local newdir = vim.fn.fnamemodify(utils.path_remove_trailing(core.get_cwd()), ":h")
|
||||
require("nvim-tree.actions.root.change-dir").fn(newdir)
|
||||
return require("nvim-tree.actions.finders.find-file").fn(node.absolute_path)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user