commit 677a83b2b63fda1c52205acd39973fe1b44e8b54
parent fb15cfbf4504660f7b23dbe099b8736071fb0665
Author: Martin Grenfell <martin.grenfell@gmail.com>
Date: Wed, 25 Nov 2015 23:29:00 +0000
remove NERDTreeDirArrows option
Use +/~ for windows - which seems to not have the arrow chars in its
default font. TBH I don't really understand this.
Inprove the UI indent matching so that it should handle any combo of
open/close symbol lengths e.g. the fancy arrows are 3 bytes each,
whereas +/~ are 1 byte each.
Diffstat:
3 files changed, 13 insertions(+), 26 deletions(-)
diff --git 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.
@@ -987,19 +984,6 @@ of the following lines to set this option: >
<
------------------------------------------------------------------------------
- *'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
Default: 1.
diff --git 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
@@ -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")