mirror of
https://github.com/nvim-tree/nvim-tree.lua
synced 2024-09-16 14:34:03 +02:00
fix: do not group empty at root
This commit is contained in:
parent
1ab7812c62
commit
e42a4337d0
2 changed files with 6 additions and 4 deletions
|
@ -36,9 +36,10 @@ function M.explore(node, cwd, status)
|
|||
end
|
||||
end
|
||||
|
||||
if vim.g.nvim_tree_group_empty == 1 then
|
||||
local is_root = node.cwd ~= nil
|
||||
if vim.g.nvim_tree_group_empty == 1 and not is_root and #(node.nodes) == 1 then
|
||||
local child_node = node.nodes[1]
|
||||
if #(node.nodes) == 1 and child_node.nodes and uv.fs_access(child_node.absolute_path, 'R') then
|
||||
if child_node.nodes and uv.fs_access(child_node.absolute_path, 'R') then
|
||||
node.group_next = child_node
|
||||
local ns = M.explore(child_node, child_node.absolute_path, status)
|
||||
node.nodes = ns or {}
|
||||
|
|
|
@ -59,9 +59,10 @@ function M.reload(node, cwd, status)
|
|||
node.nodes
|
||||
)
|
||||
|
||||
if vim.g.nvim_tree_group_empty == 1 then
|
||||
local is_root = node.cwd ~= nil
|
||||
if vim.g.nvim_tree_group_empty == 1 and not is_root and #(node.nodes) == 1 then
|
||||
local child_node = node.nodes[1]
|
||||
if #(node.nodes) == 1 and child_node.nodes and uv.fs_access(child_node.absolute_path, 'R') then
|
||||
if child_node.nodes and uv.fs_access(child_node.absolute_path, 'R') then
|
||||
node.group_next = child_node
|
||||
local ns = M.reload(child_node, child_node.absolute_path, status)
|
||||
node.nodes = ns or {}
|
||||
|
|
Loading…
Reference in a new issue