Add correspoding close action to cascade open single child dir

This commit is contained in:
pendulm
2013-04-22 23:39:26 +08:00
parent 60683f1cce
commit 6ef67a2d8e
2 changed files with 13 additions and 4 deletions

View File

@@ -1068,9 +1068,17 @@ function! s:closeCurrentDir(node)
if parent ==# {} || parent.isRoot()
call nerdtree#echo("cannot close tree root")
else
call a:node.parent.close()
while g:NERDTreeCascadeOpenSingleChildDir && !parent.parent.isRoot()
if parent.parent.getVisibleChildCount() == 1
call parent.close()
let parent = parent.parent
else
break
endif
endwhile
call parent.close()
call nerdtree#renderView()
call a:node.parent.putCursorHere(0, 0)
call parent.putCursorHere(0, 0)
endif
endfunction