diff --git a/autoload/nerdtree/ui_glue.vim b/autoload/nerdtree/ui_glue.vim index 7929235..93ac567 100644 --- a/autoload/nerdtree/ui_glue.vim +++ b/autoload/nerdtree/ui_glue.vim @@ -194,15 +194,15 @@ function! s:closeCurrentDir(node) let l:parent = a:node.parent - if empty(l:parent) || l:parent.isRoot() - call nerdtree#echo('cannot close tree root') - return - endif - while l:parent.isCascadable() let l:parent = l:parent.parent endwhile + if l:parent.isRoot() + call nerdtree#echo('cannot close tree root') + return + endif + call l:parent.close() call b:NERDTree.render() call l:parent.putCursorHere(0, 0)