refactor(actions): move actions into semantic modules (#1410)

This commit is contained in:
Kiyan
2022-07-10 09:47:52 +02:00
committed by GitHub
parent 90bf14014e
commit 831f1158c3
23 changed files with 85 additions and 76 deletions

View File

@@ -0,0 +1,22 @@
local utils = require "nvim-tree.utils"
local core = require "nvim-tree.core"
local M = {}
---Retrieves the absolute path to the node.
---Safely handles the node representing the current directory
---(the topmost node in the nvim-tree window)
local function get_node_path(node)
if node.name == ".." then
return utils.path_remove_trailing(core.get_cwd())
else
return node.absolute_path
end
end
function M.run_file_command(node)
local node_path = get_node_path(node)
vim.api.nvim_input(": " .. node_path .. "<Home>")
end
return M