---------- 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-20121111.patch
Description: Binary data