Hi. I found another issue with vim sources syntax highlights.
In the following code: fun! VimwikiLinkHandler(link) let link = a:link if link =~ "vlocal:" || link =~ "vfile:" let link = link[1:] else return 0 endif " blah-blah endif line 'if link =~ "vlocal:" || link =~ "vfile:"' will be highlighted incorrectly because link is mistakenly regarded as part of region vimHiLink and highlighted as vimCommand (and the trail of the line is also spoiled). 'link[1:]' is also mistakenly regarded as part of region vimHiLink. The problem is in definition of vimHiLink: it should check if '\(def\%[ault]\s\+\)\=link\>\|\<def\>' is prceded by '\(\<hi\%[ghlight]\s\+\)'. So the new patch (including previous changes) is: --- runtime/syntax/vim.vim 2012-11-13 11:47:49.841267569 +0400 +++ runtime/syntax/vim.vim.new 2012-11-13 13:22:36.769912872 +0400 @@ -152,8 +152,8 @@ syn cluster vimOperGroup contains=vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimRegister,vimContinue syn match vimOper "\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "||\|&&\|[-+.]" skipwhite nextgroup=vimString,vimSpecFile -syn region vimOperParen oneline matchgroup=vimParenSep start="(" end=")" contains=@vimOperGroup -syn region vimOperParen oneline matchgroup=vimSep start="{" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar +syn region vimOperParen matchgroup=vimParenSep start="(" end=")" contains=@vimOperGroup +syn region vimOperParen matchgroup=vimSep start="{" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noopererror") syn match vimOperError ")" endif @@ -328,7 +328,7 @@ syn match vimMapBang contained "!" skipwhite nextgroup=vimMapMod,vimMapLhs syn match vimMapMod contained "\c<\(buffer\|expr\|\(local\)\=leader\|plug\|script\|sid\|unique\|silent\)\+>" contains=vimMapModKey,vimMapModErr skipwhite nextgroup=vimMapMod,vimMapLhs syn match vimMapRhs contained ".*" contains=vimNotation,vimCtrlChar skipnl nextgroup=vimMapRhsExtend -syn match vimMapRhsExtend contained "^\s*\\.*$" contains=vimContinue +syn match vimMapRhsExtend contained "^\s*\\.*$" contains=vimNotation,vimCtrlChar,vimContinue skipnl nextgroup=vimMapRhsExtend syn case ignore syn keyword vimMapModKey contained buffer expr leader localleader plug script sid silent unique syn case match @@ -520,7 +520,7 @@ syn keyword vimHiClear contained clear nextgroup=vimHiGroup " Highlight: link {{{2 -syn region vimHiLink contained oneline matchgroup=vimCommand start="\<\(def\%[ault]\s\+\)\=link\>\|\<def\>" end="$" contains=vimHiGroup,vimGroup,vimHLGroup,vimNotation +syn region vimHiLink contained oneline matchgroup=vimCommand start="\(\<hi\%[ghlight]\s\+\)\@<=\(\(def\%[ault]\s\+\)\=link\>\|\<def\>\)" end="$" contains=vimHiGroup,vimGroup,vimHLGroup,vimNotation syn cluster vimFuncBodyList add=vimHiLink " Control Characters {{{2 The patch is also included. Cheers, Alexey. 2012/11/12 Alexey Radkov <alexey.rad...@gmail.com> > > > ---------- Forwarded message ---------- > From: Alexey Radkov <alexey.rad...@gmail.com> > Date: 2012/11/11 > Subject: some vim syntax fixes for multi-lined commands > To: vim-...@vim.org > > > (missed vim_dev@googlegroups recipient) > > > Hi. > > Here are some fixes for errors in vim syntax highlight for multi-lined > commands found when looking through my .vimrc and other vim sources. I used > to keep lines in sources short (78 columns for vim) so i often used line > breaks. > > The patch against current hg version (also attached): > > > --- runtime/syntax/vim.vim 2012-11-11 15:56:35.733116733 +0400 > +++ runtime/syntax/vim.vim.new 2012-11-11 19:35:46.579257610 +0400 > @@ -152,8 +152,8 @@ > syn cluster vimOperGroup > contains=vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimRegister,vimContinue > syn match vimOper > "\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite > nextgroup=vimString,vimSpecFile > syn match vimOper "||\|&&\|[-+.]" skipwhite > nextgroup=vimString,vimSpecFile > -syn region vimOperParen oneline matchgroup=vimParenSep > start="(" end=")" contains=@vimOperGroup > -syn region vimOperParen oneline matchgroup=vimSep start="{" > end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar > +syn region vimOperParen matchgroup=vimParenSep start="(" > end=")" contains=@vimOperGroup > +syn region vimOperParen matchgroup=vimSep start="{" end="}" > contains=@vimOperGroup nextgroup=vimVar,vimFuncVar > if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noopererror") > syn match vimOperError ")" > endif > @@ -328,7 +328,7 @@ > syn match vimMapBang contained "!" skipwhite > nextgroup=vimMapMod,vimMapLhs > syn match vimMapMod contained > "\c<\(buffer\|expr\|\(local\)\=leader\|plug\|script\|sid\|unique\|silent\)\+>" > contains=vimMapModKey,vimMapModErr skipwhite nextgroup=vimMapMod,vimMapLhs > syn match vimMapRhs contained ".*" > contains=vimNotation,vimCtrlChar skipnl nextgroup=vimMapRhsExtend > -syn match vimMapRhsExtend contained "^\s*\\.*$" > contains=vimContinue > +syn match vimMapRhsExtend contained "^\s*\\.*$" > contains=vimNotation,vimCtrlChar,vimContinue skipnl > nextgroup=vimMapRhsExtend > syn case ignore > syn keyword vimMapModKey contained buffer expr leader > localleader plug script sid silent unique > syn case match > > > The error cases and explanations: > > 1. Source: > > nmap <silent> ,h :if !exists("w:m1") <Bar><Bar> w:m1 == 0 <Bar> > \ ShowFormatHints <Bar> echo "Show format hints" <Bar> else > <Bar> > \ HideFormatHints <Bar> echo "Hide format hints" <Bar> > endif<CR> > > > What's wrong in highlights: > a. <Bar>'s in second line are not highlighted > b. 3rd line is highlighted differently than vimMapRhs > > What's wrong in syntax/vim.vim > a. vimMapRhsExtend must contain same groups as vimRhs, i.e. > vimNotation,vimCtrlChar > b. vimRhsExtend could span more than 1 line, i.e. it should contain > 'skipnl nextgroup=vimMapRhsExtend' > > > 2. Source: > > let g:WikiGlobal.nested_syntaxes = {'c': 'c', 'c++': 'cpp', 'perl': 'perl', > \ 'python': 'python', 'sh': 'sh'} > > What's wrong in highlights: > area 'c++': 'cpp' wrongly highlighted ( ++ as operator and following it ': > ' as string) > > What's wrong in syntax/vim.vim: > vimOperParen for "{}" is 'oneline' by some reason, why? This makes no > syntax group for symbols '{' and '}'. Removing 'oneline' makes them > correctly of 'vimSep' group. > > > 3. Source > > call add(g:TagMgrTags, map(map(map(split(s:line, '\s*::\s*'), > \ 'substitute(v:val, "^!$", "", "")'), > \ 'substitute(v:val, "\\([*?]\\)", "\\\\\\1", "g")'), > \ 'expand(v:val)')) > > What's wrong in highlights: > closing parens ')', ')' and '))' in 2nd, 3rd and 4th lines respectively > are highlighted with red (vimOperError) > > What's wrong in syntax/vim.vim: > same as in the case 2., only for "()" parens. Why they should be 'oneline'? > > > Cheers, Alexey. > > > > > -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
vim_syntax-20121113.patch
Description: Binary data