nerdtree/syntax/nerdtree.vim

92 lines
3.9 KiB
VimL
Raw Permalink Normal View History

let s:tree_up_dir_line = '.. (up a dir)'
syn match NERDTreeIgnore #\~#
exec 'syn match NERDTreeIgnore #\['.g:NERDTreeGlyphReadOnly.'\]#'
"highlighting for the .. (up dir) line at the top of the tree
execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#"
"quickhelp syntax elements
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#ms=s+2,me=e-1
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#ms=s+2,me=e-1
syn match NERDTreeHelpTitle #" .*\~$#ms=s+2,me=e-1
syn match NERDTreeToggleOn #(on)#ms=s+1,he=e-1
syn match NERDTreeToggleOff #(off)#ms=e-3,me=e-1
syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3
syn match NERDTreeHelp #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeIgnore,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand
"highlighting for sym links
syn match NERDTreeLinkTarget #->.*# containedin=NERDTreeDir,NERDTreeFile
syn match NERDTreeLinkFile #.* ->#me=e-3 containedin=NERDTreeFile
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'
2014-06-30 00:44:19 +04:00
"highlighting for readonly files
exec 'syn match NERDTreeRO # *\zs.*\ze \['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
syn match NERDTreeFlags #^ *\zs\[[^\]]*\]# containedin=NERDTreeFile,NERDTreeExecFile
syn match NERDTreeFlags #\[[^\]]*\]# containedin=NERDTreeDir
Support unusual characters in file and directory names (#868) * Use a delimiter in node to separate file/dir name from the rest. * Switch warning message to use nerdtree#deprecated function. * Compress the space between the tree symbols and the node. * Include the delimiter when calculating indent or getting filename. * Don't need to strip leading delimiter. It will already be gone. * Simplify the way the delimiter is being used. I don't know what I was thinking. The delimiter doesn't need to be used to separate every indicator on the node's text, ie. Bad: Tree|GenericFlags|Filename|ExecutableFlag|Link|ReadonlyFlag Better: Tree GenericFlags|Filename|ExecutableFlag Link ReadonlyFlag This was unnecessary, given that we're only interested in the filename. So, just one pair of delimiters is all we need. That greatly simplifies the _stripMarkup function, and restores a bunch of other statements to what they already are in the master branch. * Add syntax highlighting to conceal the delimiter * Put a if has("conceal") check around the syntax statement using it. * Make concealment work correctly for LinkFile and readonly files. * Use highlight Ignore if conceal isn't available. This is probably the best we can do, especially if some other character must be used in place of nbsp. * Make the regex better match the original, but more compact. It was allowing 2+ spaces, instead of only 1+. * Fix the syntax highlighing of delimiters around NERDTreeExecFile. * Bug fix: Parse . and .. from path string with trailing slash. * Fix unresponsive cascaded directories. Using ':' as a more visible delimiter, when directories are cascaded, the line appears in NERDTree like so: ▾ :lib/::nerdtree/: Before this commit, the s:UI._stripMarkup function was leaving the internal delimiters in place (lib/::nerdtree/). Now they are removed, resulting in a valid path (lib/nerdtree/). * Use .= to shorten statement. Use clearer substitutes to get node name. * Remove node delimiters that terminate the line. * If flags are needed after the node name, then put another delimiter before them. * When joining directory nodes for cascaded display, strip off the delimiter from the child node(s). * Remove the unnecessary substitution of doubled intermediate delimiters, since they're not in there anymore. * DRY up the addition of the 2nd delimiter, and use only 1 for all tags.
2018-10-25 05:41:13 +03:00
"highlighing to conceal the delimiter around the file/dir name
if has("conceal")
exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# conceal containedin=ALL'
setlocal conceallevel=3 concealcursor=nvic
Support unusual characters in file and directory names (#868) * Use a delimiter in node to separate file/dir name from the rest. * Switch warning message to use nerdtree#deprecated function. * Compress the space between the tree symbols and the node. * Include the delimiter when calculating indent or getting filename. * Don't need to strip leading delimiter. It will already be gone. * Simplify the way the delimiter is being used. I don't know what I was thinking. The delimiter doesn't need to be used to separate every indicator on the node's text, ie. Bad: Tree|GenericFlags|Filename|ExecutableFlag|Link|ReadonlyFlag Better: Tree GenericFlags|Filename|ExecutableFlag Link ReadonlyFlag This was unnecessary, given that we're only interested in the filename. So, just one pair of delimiters is all we need. That greatly simplifies the _stripMarkup function, and restores a bunch of other statements to what they already are in the master branch. * Add syntax highlighting to conceal the delimiter * Put a if has("conceal") check around the syntax statement using it. * Make concealment work correctly for LinkFile and readonly files. * Use highlight Ignore if conceal isn't available. This is probably the best we can do, especially if some other character must be used in place of nbsp. * Make the regex better match the original, but more compact. It was allowing 2+ spaces, instead of only 1+. * Fix the syntax highlighing of delimiters around NERDTreeExecFile. * Bug fix: Parse . and .. from path string with trailing slash. * Fix unresponsive cascaded directories. Using ':' as a more visible delimiter, when directories are cascaded, the line appears in NERDTree like so: ▾ :lib/::nerdtree/: Before this commit, the s:UI._stripMarkup function was leaving the internal delimiters in place (lib/::nerdtree/). Now they are removed, resulting in a valid path (lib/nerdtree/). * Use .= to shorten statement. Use clearer substitutes to get node name. * Remove node delimiters that terminate the line. * If flags are needed after the node name, then put another delimiter before them. * When joining directory nodes for cascaded display, strip off the delimiter from the child node(s). * Remove the unnecessary substitution of doubled intermediate delimiters, since they're not in there anymore. * DRY up the addition of the 2nd delimiter, and use only 1 for all tags.
2018-10-25 05:41:13 +03:00
else
exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# containedin=ALL'
Support unusual characters in file and directory names (#868) * Use a delimiter in node to separate file/dir name from the rest. * Switch warning message to use nerdtree#deprecated function. * Compress the space between the tree symbols and the node. * Include the delimiter when calculating indent or getting filename. * Don't need to strip leading delimiter. It will already be gone. * Simplify the way the delimiter is being used. I don't know what I was thinking. The delimiter doesn't need to be used to separate every indicator on the node's text, ie. Bad: Tree|GenericFlags|Filename|ExecutableFlag|Link|ReadonlyFlag Better: Tree GenericFlags|Filename|ExecutableFlag Link ReadonlyFlag This was unnecessary, given that we're only interested in the filename. So, just one pair of delimiters is all we need. That greatly simplifies the _stripMarkup function, and restores a bunch of other statements to what they already are in the master branch. * Add syntax highlighting to conceal the delimiter * Put a if has("conceal") check around the syntax statement using it. * Make concealment work correctly for LinkFile and readonly files. * Use highlight Ignore if conceal isn't available. This is probably the best we can do, especially if some other character must be used in place of nbsp. * Make the regex better match the original, but more compact. It was allowing 2+ spaces, instead of only 1+. * Fix the syntax highlighing of delimiters around NERDTreeExecFile. * Bug fix: Parse . and .. from path string with trailing slash. * Fix unresponsive cascaded directories. Using ':' as a more visible delimiter, when directories are cascaded, the line appears in NERDTree like so: ▾ :lib/::nerdtree/: Before this commit, the s:UI._stripMarkup function was leaving the internal delimiters in place (lib/::nerdtree/). Now they are removed, resulting in a valid path (lib/nerdtree/). * Use .= to shorten statement. Use clearer substitutes to get node name. * Remove node delimiters that terminate the line. * If flags are needed after the node name, then put another delimiter before them. * When joining directory nodes for cascaded display, strip off the delimiter from the child node(s). * Remove the unnecessary substitution of doubled intermediate delimiters, since they're not in there anymore. * DRY up the addition of the 2nd delimiter, and use only 1 for all tags.
2018-10-25 05:41:13 +03:00
hi! link NERDTreeNodeDelimiters Ignore
endif
syn match NERDTreeCWD #^[</].*$#
"highlighting for bookmarks
syn match NERDTreeBookmark # {.*}#hs=s+1
"highlighting for the bookmarks table
syn match NERDTreeBookmarksLeader #^>#
syn match NERDTreeBookmarksHeader #^>-\+Bookmarks-\+$# contains=NERDTreeBookmarksLeader
syn match NERDTreeBookmarkName #^>.\{-} #he=e-1 contains=NERDTreeBookmarksLeader
syn match NERDTreeBookmark #^>.*$# contains=NERDTreeBookmarksLeader,NERDTreeBookmarkName,NERDTreeBookmarksHeader
hi def link NERDTreePart Special
hi def link NERDTreePartFile Type
hi def link NERDTreeExecFile Title
hi def link NERDTreeDirSlash Identifier
hi def link NERDTreeBookmarksHeader statement
hi def link NERDTreeBookmarksLeader ignore
hi def link NERDTreeBookmarkName Identifier
hi def link NERDTreeBookmark normal
hi def link NERDTreeHelp String
hi def link NERDTreeHelpKey Identifier
hi def link NERDTreeHelpCommand Identifier
hi def link NERDTreeHelpTitle Macro
hi def link NERDTreeToggleOn Question
hi def link NERDTreeToggleOff WarningMsg
hi def link NERDTreeLinkTarget Type
hi def link NERDTreeLinkFile Macro
hi def link NERDTreeLinkDir Macro
hi def link NERDTreeDir Directory
hi def link NERDTreeUp Directory
hi def link NERDTreeFile Normal
hi def link NERDTreeCWD Statement
hi def link NERDTreeOpenable Directory
hi def link NERDTreeClosable Directory
hi def link NERDTreeIgnore ignore
hi def link NERDTreeRO WarningMsg
hi def link NERDTreeBookmark Statement
hi def link NERDTreeFlags Number
hi def link NERDTreeCurrentNode Search