Added global variables for changing default arrows

g:NERDTreeDirArrowExpandable
g:NERDTreeDirArrowCollapsable
This commit is contained in:
Igor Tatarintsev 2015-09-11 23:52:37 +06:00
parent 188bd92658
commit dc29ec2db3
6 changed files with 10 additions and 10 deletions

View File

@ -112,4 +112,4 @@ Use these variables in your vimrc. Note that below are default arrow symbols
let g:NERDTreeDirArrows = 1 let g:NERDTreeDirArrows = 1
let g:NERDTreeDirArrowExpandable = '▸' let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsable = '▾' let g:NERDTreeDirArrowCollapsible = '▾'

View File

@ -312,7 +312,7 @@ function! s:handleLeftClick()
endfor endfor
if currentNode.path.isDirectory if currentNode.path.isDirectory
if startToCur =~# g:NERDTreeUI.MarkupReg() && startToCur =~# '[+~'.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsable.'] \?$' if startToCur =~# g:NERDTreeUI.MarkupReg() && startToCur =~# '[+~'.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'] \?$'
call currentNode.activate() call currentNode.activate()
return return
endif endif

View File

@ -383,7 +383,7 @@ function! s:TreeFileNode._renderToString(depth, drawText, vertMap, isLastChild)
if self.path.isDirectory if self.path.isDirectory
if self.isOpen if self.isOpen
if g:NERDTreeDirArrows if g:NERDTreeDirArrows
let treeParts = treeParts . g:NERDTreeDirArrowCollapsable . ' ' let treeParts = treeParts . g:NERDTreeDirArrowCollapsible . ' '
else else
let treeParts = treeParts . '~' let treeParts = treeParts . '~'
endif endif

View File

@ -154,7 +154,7 @@ function! s:UI.getPath(ln)
if !g:NERDTreeDirArrows if !g:NERDTreeDirArrows
" in case called from outside the tree " in case called from outside the tree
if line !~# '^ *[|`'.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsable.' ]' || line =~# '^$' if line !~# '^ *[|`'.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.' ]' || line =~# '^$'
return {} return {}
endif endif
endif endif
@ -261,9 +261,9 @@ endfunction
"FUNCTION: s:UI._indentLevelFor(line) {{{1 "FUNCTION: s:UI._indentLevelFor(line) {{{1
function! s:UI._indentLevelFor(line) function! s:UI._indentLevelFor(line)
let level = match(a:line, '[^ \-+~'.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsable.'`|]') / s:UI.IndentWid() let level = match(a:line, '[^ \-+~'.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'`|]') / s:UI.IndentWid()
" check if line includes arrows " check if line includes arrows
if match(a:line, '['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsable.]') > -1 if match(a:line, '['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']') > -1
" decrement level as arrow uses 3 ascii chars " decrement level as arrow uses 3 ascii chars
let level = level - 1 let level = level - 1
endif endif
@ -278,7 +278,7 @@ endfunction
"FUNCTION: s:UI.MarkupReg() {{{1 "FUNCTION: s:UI.MarkupReg() {{{1
function! s:UI.MarkupReg() function! s:UI.MarkupReg()
if g:NERDTreeDirArrows if g:NERDTreeDirArrows
return '^\(['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsable.'] \| \+['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsable.'] \| \+\)' return '^\(['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'] \| \+['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'] \| \+\)'
endif endif
return '^[ `|]*[\-+~]' return '^[ `|]*[\-+~]'

View File

@ -69,7 +69,7 @@ call s:initVariable("g:NERDTreeShowLineNumbers", 0)
call s:initVariable("g:NERDTreeSortDirs", 1) call s:initVariable("g:NERDTreeSortDirs", 1)
call s:initVariable("g:NERDTreeDirArrows", !nerdtree#runningWindows()) call s:initVariable("g:NERDTreeDirArrows", !nerdtree#runningWindows())
call s:initVariable("g:NERDTreeDirArrowExpandable", "▸") call s:initVariable("g:NERDTreeDirArrowExpandable", "▸")
call s:initVariable("g:NERDTreeDirArrowCollapsable", "▾") call s:initVariable("g:NERDTreeDirArrowCollapsible", "▾")
call s:initVariable("g:NERDTreeCascadeOpenSingleChildDir", 1) call s:initVariable("g:NERDTreeCascadeOpenSingleChildDir", 1)
if !exists("g:NERDTreeSortOrder") if !exists("g:NERDTreeSortOrder")

View File

@ -23,10 +23,10 @@ syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir
syn match NERDTreeDirSlash #/# containedin=NERDTreeDir syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
if g:NERDTreeDirArrows if g:NERDTreeDirArrows
exec 'syn match NERDTreeClosable #'.g:NERDTreeDirArrowCollapsable.'# containedin=NERDTreeDir,NERDTreeFile' exec 'syn match NERDTreeClosable #'.g:NERDTreeDirArrowCollapsible.'# containedin=NERDTreeDir,NERDTreeFile'
exec 'syn match NERDTreeOpenable #'.g:NERDTreeDirArrowExpandable.'# containedin=NERDTreeDir,NERDTreeFile' exec 'syn match NERDTreeOpenable #'.g:NERDTreeDirArrowExpandable.'# containedin=NERDTreeDir,NERDTreeFile'
let s:dirArrows = g:NERDTreeDirArrowCollapsable.g:NERDTreeDirArrowExpandable let s:dirArrows = g:NERDTreeDirArrowCollapsible.g:NERDTreeDirArrowExpandable
exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#' exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
syn match NERDTreeExecFile #^ .*\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark syn match NERDTreeExecFile #^ .*\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile' exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'