From d68c9abca81943b0e5c5028c9c745b04b1e09afb Mon Sep 17 00:00:00 2001 From: Jason Franklin Date: Sat, 29 Jul 2017 09:40:11 -0400 Subject: [PATCH] Improve three highlighting rules The highlighting rules "NERDTreeClosable" and "NERDTreeOpenable" did not recognize files beginning with a "~" character. This caused bad highlighting on systems that use "~" and "+" for the dir arrow symbols by default. Making these rules more specific solves this problem. The "~" characters in quickhelp section titles also would get confused with a custom mapping for "~". Adjusting the "NERDTreeHelpTitle" solved this problem. I also changed the quickhelp title in a minor way to reflect the proper spelling of "NERDTree". --- lib/nerdtree/ui.vim | 2 +- syntax/nerdtree.vim | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/nerdtree/ui.vim b/lib/nerdtree/ui.vim index e169dbb..03f11b8 100644 --- a/lib/nerdtree/ui.vim +++ b/lib/nerdtree/ui.vim @@ -21,7 +21,7 @@ endfunction "prints out the quick help function! s:UI._dumpHelp() if self.getShowHelp() - let help = "\" NERD tree (" . nerdtree#version() . ") quickhelp~\n" + let help = "\" NERDTree (" . nerdtree#version() . ") quickhelp~\n" let help .= "\" ============================\n" let help .= "\" File node mappings~\n" let help .= "\" ". (g:NERDTreeMouseMode ==# 3 ? "single" : "double") ."-click,\n" diff --git a/syntax/nerdtree.vim b/syntax/nerdtree.vim index e93ca1d..7c80605 100644 --- a/syntax/nerdtree.vim +++ b/syntax/nerdtree.vim @@ -8,7 +8,7 @@ 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 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 @@ -22,8 +22,8 @@ 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, '~').'# containedin=NERDTreeDir,NERDTreeFile' -exec 'syn match NERDTreeOpenable #'.escape(g:NERDTreeDirArrowExpandable, '~').'# containedin=NERDTreeDir,NERDTreeFile' +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.' ].*/#'