diff --git a/autoload/nerdtree/ui_glue.vim b/autoload/nerdtree/ui_glue.vim index 0912faf..4cbfb38 100644 --- a/autoload/nerdtree/ui_glue.vim +++ b/autoload/nerdtree/ui_glue.vim @@ -191,8 +191,8 @@ function! s:closeCurrentDir(node) call nerdtree#echo("cannot close tree root") else while g:NERDTreeCascadeOpenSingleChildDir && !parent.parent.isRoot() - if parent.parent.getVisibleChildCount() == 1 - call parent.close() + let childNodes = parent.getVisibleChildren() + if len(childNodes) == 1 && childNodes[0].path.isDirectory let parent = parent.parent else break