diff --git a/doc/NERD_tree.txt b/doc/NERD_tree.txt index ccc60b5..1ad8e18 100644 --- a/doc/NERD_tree.txt +++ b/doc/NERD_tree.txt @@ -671,9 +671,6 @@ NERD tree. These options should be set in your vimrc. |'NERDTreeMinimalUI'| Disables display of the 'Bookmarks' label and 'Press ? for help' text. -|'NERDTreeDirArrows'| Tells the NERD tree to use arrows instead of - + ~ chars when displaying directories. - |'NERDTreeCascadeOpenSingleChildDir'| Cascade open while selected directory has only one child that also is a directory. @@ -986,19 +983,6 @@ of the following lines to set this option: > let NERDTreeMinimalUI=1 < ------------------------------------------------------------------------------- - *'NERDTreeDirArrows'* -Values: 0 or 1 -Default: 0. - -This option is used to change the default look of directory nodes displayed in -the tree. When set to 0 it shows old-school bars (|), + and ~ chars. If set to -1 it shows right and down arrows. Use one of the follow lines to set this -option: > - let NERDTreeDirArrows=0 - let NERDTreeDirArrows=1 -< - ------------------------------------------------------------------------------ *'NERDTreeCascadeOpenSingleChildDir'* Values: 0 or 1 diff --git a/lib/nerdtree/ui.vim b/lib/nerdtree/ui.vim index 55edb60..ed23526 100644 --- a/lib/nerdtree/ui.vim +++ b/lib/nerdtree/ui.vim @@ -287,13 +287,11 @@ endfunction "FUNCTION: s:UI._indentLevelFor(line) {{{1 function! s:UI._indentLevelFor(line) - let level = match(a:line, '[^ \-+~'.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'`|]') / s:UI.IndentWid() - " check if line includes arrows - if match(a:line, '['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']') > -1 - " decrement level as arrow uses 3 ascii chars - let level = level - 1 - endif - return level + "have to do this work around because match() returns bytes, not chars + let numLeadBytes = match(a:line, '\M\[^ '.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']') + let leadChars = strchars(a:line[0:numLeadBytes-1]) + + return leadChars / s:UI.IndentWid() endfunction "FUNCTION: s:UI.IndentWid() {{{1 diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 515bef9..bbcc55f 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -65,9 +65,14 @@ call s:initVariable("g:NERDTreeShowFiles", 1) call s:initVariable("g:NERDTreeShowHidden", 0) call s:initVariable("g:NERDTreeShowLineNumbers", 0) call s:initVariable("g:NERDTreeSortDirs", 1) -call s:initVariable("g:NERDTreeDirArrows", !nerdtree#runningWindows()) -call s:initVariable("g:NERDTreeDirArrowExpandable", "▸") -call s:initVariable("g:NERDTreeDirArrowCollapsible", "▾") + +if !nerdtree#runningWindows() + call s:initVariable("g:NERDTreeDirArrowExpandable", "▸") + call s:initVariable("g:NERDTreeDirArrowCollapsible", "▾") +else + call s:initVariable("g:NERDTreeDirArrowExpandable", "+") + call s:initVariable("g:NERDTreeDirArrowCollapsible", "~") +endif call s:initVariable("g:NERDTreeCascadeOpenSingleChildDir", 1) if !exists("g:NERDTreeSortOrder")