feat: option to set path destination to parent folder when cursor is on a closed folder while creating files (#628)

This commit is contained in:
booperlv
2021-09-26 18:10:19 +08:00
committed by GitHub
parent 1edebb7894
commit 2a5d529219
3 changed files with 10 additions and 1 deletions

View File

@@ -57,8 +57,10 @@ function M.create(node)
}
end
local node_is_open = vim.g.nvim_tree_create_in_closed_folder == 1 or node.open
local add_into
if node.entries ~= nil then
if node.entries ~= nil and node_is_open then
add_into = utils.path_add_trailing(node.absolute_path)
else
add_into = node.absolute_path:sub(0, -(#node.name + 1))