mirror of
https://github.com/preservim/nerdtree.git
synced 2024-11-26 18:30:45 +08:00
Merge pull request #482 from PickRelated/master
Added global variables for changing default arrows
This commit is contained in:
commit
8c7534bc9e
|
@ -105,3 +105,11 @@ Stick this in your vimrc:
|
|||
> Can I have different highlighting for different file extensions?
|
||||
|
||||
See here: https://github.com/scrooloose/nerdtree/issues/433#issuecomment-92590696
|
||||
|
||||
> How can I change default arrows?
|
||||
|
||||
Use these variables in your vimrc. Note that below are default arrow symbols
|
||||
|
||||
let g:NERDTreeDirArrows = 1
|
||||
let g:NERDTreeDirArrowExpandable = '▸'
|
||||
let g:NERDTreeDirArrowCollapsible = '▾'
|
||||
|
|
|
@ -312,7 +312,7 @@ function! s:handleLeftClick()
|
|||
endfor
|
||||
|
||||
if currentNode.path.isDirectory
|
||||
if startToCur =~# g:NERDTreeUI.MarkupReg() && startToCur =~# '[+~▾▸] \?$'
|
||||
if startToCur =~# g:NERDTreeUI.MarkupReg() && startToCur =~# '[+~'.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'] \?$'
|
||||
call currentNode.activate()
|
||||
return
|
||||
endif
|
||||
|
|
|
@ -383,13 +383,13 @@ function! s:TreeFileNode._renderToString(depth, drawText, vertMap, isLastChild)
|
|||
if self.path.isDirectory
|
||||
if self.isOpen
|
||||
if g:NERDTreeDirArrows
|
||||
let treeParts = treeParts . '▾ '
|
||||
let treeParts = treeParts . g:NERDTreeDirArrowCollapsible . ' '
|
||||
else
|
||||
let treeParts = treeParts . '~'
|
||||
endif
|
||||
else
|
||||
if g:NERDTreeDirArrows
|
||||
let treeParts = treeParts . '▸ '
|
||||
let treeParts = treeParts . g:NERDTreeDirArrowExpandable . ' '
|
||||
else
|
||||
let treeParts = treeParts . '+'
|
||||
endif
|
||||
|
|
|
@ -154,7 +154,7 @@ function! s:UI.getPath(ln)
|
|||
|
||||
if !g:NERDTreeDirArrows
|
||||
" in case called from outside the tree
|
||||
if line !~# '^ *[|`▸▾ ]' || line =~# '^$'
|
||||
if line !~# '^ *[|`'.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.' ]' || line =~# '^$'
|
||||
return {}
|
||||
endif
|
||||
endif
|
||||
|
@ -261,9 +261,9 @@ endfunction
|
|||
|
||||
"FUNCTION: s:UI._indentLevelFor(line) {{{1
|
||||
function! s:UI._indentLevelFor(line)
|
||||
let level = match(a:line, '[^ \-+~▸▾`|]') / s:UI.IndentWid()
|
||||
let level = match(a:line, '[^ \-+~'.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'`|]') / s:UI.IndentWid()
|
||||
" check if line includes arrows
|
||||
if match(a:line, '[▸▾]') > -1
|
||||
if match(a:line, '['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']') > -1
|
||||
" decrement level as arrow uses 3 ascii chars
|
||||
let level = level - 1
|
||||
endif
|
||||
|
@ -278,7 +278,7 @@ endfunction
|
|||
"FUNCTION: s:UI.MarkupReg() {{{1
|
||||
function! s:UI.MarkupReg()
|
||||
if g:NERDTreeDirArrows
|
||||
return '^\([▾▸] \| \+[▾▸] \| \+\)'
|
||||
return '^\(['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'] \| \+['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'] \| \+\)'
|
||||
endif
|
||||
|
||||
return '^[ `|]*[\-+~]'
|
||||
|
|
|
@ -68,6 +68,8 @@ 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", "▾")
|
||||
call s:initVariable("g:NERDTreeCascadeOpenSingleChildDir", 1)
|
||||
|
||||
if !exists("g:NERDTreeSortOrder")
|
||||
|
|
|
@ -23,12 +23,13 @@ syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir
|
|||
syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
|
||||
|
||||
if g:NERDTreeDirArrows
|
||||
syn match NERDTreeClosable #▾# containedin=NERDTreeDir,NERDTreeFile
|
||||
syn match NERDTreeOpenable #▸# containedin=NERDTreeDir,NERDTreeFile
|
||||
exec 'syn match NERDTreeClosable #'.g:NERDTreeDirArrowCollapsible.'# containedin=NERDTreeDir,NERDTreeFile'
|
||||
exec 'syn match NERDTreeOpenable #'.g:NERDTreeDirArrowExpandable.'# containedin=NERDTreeDir,NERDTreeFile'
|
||||
|
||||
syn match NERDTreeDir #[^▾▸ ].*/#
|
||||
let s:dirArrows = g:NERDTreeDirArrowCollapsible.g:NERDTreeDirArrowExpandable
|
||||
exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
|
||||
syn match NERDTreeExecFile #^ .*\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark
|
||||
syn match NERDTreeFile #^[^"\.▾▸] *[^▾▸]*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile
|
||||
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
|
||||
|
||||
"highlighting for readonly files
|
||||
syn match NERDTreeRO # *\zs.*\ze \[RO\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile
|
||||
|
|
Loading…
Reference in New Issue
Block a user