diff --git a/lib/nerdtree/ui.vim b/lib/nerdtree/ui.vim index 9ae643b..ff85589 100644 --- a/lib/nerdtree/ui.vim +++ b/lib/nerdtree/ui.vim @@ -280,11 +280,10 @@ endfunction " FUNCTION: s:UI._indentLevelFor(line) {{{1 function! s:UI._indentLevelFor(line) - " have to do this work around because match() returns bytes, not chars - let numLeadBytes = match(a:line, '\M\[^ '.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']') - " The next line is a backward-compatible workaround for strchars(a:line(0:numLeadBytes-1]). strchars() is in 7.3+ - let leadChars = len(split(a:line[0:numLeadBytes-1], '\zs')) - + " Replace multi-character DirArrows with a single space so the + " indentation calculation doesn't get messed up. + let l:line = substitute(substitute(a:line, g:NERDTreeDirArrowExpandable, ' ', ''), g:NERDTreeDirArrowCollapsible, ' ', '') + let leadChars = match(l:line, '\M\[^ ]') return leadChars / s:UI.IndentWid() endfunction diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index a18082e..4384c93 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -77,6 +77,7 @@ else call s:initVariable("g:NERDTreeDirArrowExpandable", "+") call s:initVariable("g:NERDTreeDirArrowCollapsible", "~") endif + call s:initVariable("g:NERDTreeCascadeOpenSingleChildDir", 1) call s:initVariable("g:NERDTreeCascadeSingleChildDir", 1)