Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] closing of collapsible directories in NERDTree plugin #432

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 17 additions & 21 deletions nerdtree_plugin/webdevicons.vim
Original file line number Diff line number Diff line change
Expand Up @@ -257,28 +257,24 @@ function! WebDevIconsNERDTreeMapCloseChildren(node)
endfunction

function! WebDevIconsNERDTreeMapCloseDir(node)
" continue with normal original logic:
let parent = a:node.parent
while g:NERDTreeCascadeOpenSingleChildDir && !parent.isRoot()
let childNodes = parent.getVisibleChildren()
if len(childNodes) == 1 && childNodes[0].path.isDirectory
let parent = parent.parent
else
break
endif
let l:parent = a:node.parent
while l:parent.isCascadable()
let l:parent = l:parent.parent
endwhile
if parent ==# {} || parent.isRoot()
call nerdtree#echo('cannot close tree root')
else
call parent.close()
" update the glyph
call WebDevIconsNERDTreeDirClose(parent)
call b:NERDTree.render()
call parent.putCursorHere(0, 0)
" glyph change possible artifact clean-up
if g:DevIconsEnableNERDTreeRedraw ==# 1
redraw!
endif

if l:parent.isRoot()
call nerdtree#echo('cannot close tree root')
return
endif

call parent.close()
" update the glyph
call WebDevIconsNERDTreeDirClose(parent)
call b:NERDTree.render()
call parent.putCursorHere(0, 0)
" glyph change possible artifact clean-up
if g:DevIconsEnableNERDTreeRedraw ==# 1
redraw!
endif
endfunction

Expand Down