nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit 961c3571c4ffafa462022814b1fe24de0c7d38c8
parent 26333ceeabaa6770475fd0d80c47c0ff585c898f
Author: Phil Runninger <prunninger@vhtcx.com>
Date:   Mon,  3 Feb 2020 01:59:41 -0500

WIP: Fix syntax highlighting when arrows are empty strings.

Also improved some highlighting to make use of g:NERDTreeNodeDelimiter,
which directly surrounds the filename. More of this to come as errors
are tracked down and fixed in this file.

Diffstat:
Msyntax/nerdtree.vim | 24++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/syntax/nerdtree.vim b/syntax/nerdtree.vim
@@ -22,19 +22,23 @@ syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir
 "highlighing for directory nodes and file nodes
 syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
 
-exec 'syn match NERDTreeClosable #' . escape(g:NERDTreeDirArrowCollapsible, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
-exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
-
-let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
-exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
-syn match NERDTreeExecFile  '^ .*\*\($\| \)' contains=NERDTreeRO,NERDTreeBookmark
-exec 'syn match NERDTreeFile  #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
+if g:NERDTreeDirArrowExpandable != ''
+    exec 'syn match NERDTreeClosable #' . escape(g:NERDTreeDirArrowCollapsible, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
+    exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
+    let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
+    exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
+    exec 'syn match NERDTreeExecFile #^.*'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark'
+    exec 'syn match NERDTreeFile  #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
+else
+    exec 'syn match NERDTreeDir #[^'.g:NERDTreeNodeDelimiter.']\{-}/\ze\($\|'.g:NERDTreeNodeDelimiter.'\)#'
+    exec 'syn match NERDTreeExecFile #'.g:NERDTreeNodeDelimiter.'.\{-}\*\($\|'.g:NERDTreeNodeDelimiter.'\)# contains=NERDTreeRO,NERDTreeBookmark'
+    exec 'syn match NERDTreeFile     #^.\{-}'.g:NERDTreeNodeDelimiter.'.\{-}[^\/]\($\|'.g:NERDTreeNodeDelimiter.'.*\)# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
+endif
 
 "highlighting for readonly files
-exec 'syn match NERDTreeRO # *\zs.*\ze \['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
+exec 'syn match NERDTreeRO #.*'.g:NERDTreeNodeDelimiter.'\zs.*\ze'.g:NERDTreeNodeDelimiter.'.*\['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
 
-syn match NERDTreeFlags #^ *\zs\[[^\]]*\]# containedin=NERDTreeFile,NERDTreeExecFile
-syn match NERDTreeFlags #\[[^\]]*\]# containedin=NERDTreeDir
+exec 'syn match NERDTreeFlags #\[[^\]]*\]\ze'.g:NERDTreeNodeDelimiter.'# containedin=NERDTreeFile,NERDTreeExecFile,NERDTreeDir'
 
 "highlighing to conceal the delimiter around the file/dir name
 if has('conceal')