Mercurial > vim
diff runtime/syntax/generator/vim.vim.base @ 34563:98d8ef6b57c9
runtime(vim): Update base-syntax, improve :echo and :execute highlighting (#14199)
Commit: https://github.com/vim/vim/commit/61887b3d6fd8b441c90416ea7855e1fe5a9ae32c
Author: dkearns <dougkearns@gmail.com>
Date: Fri Mar 15 23:45:48 2024 +1100
runtime(vim): Update base-syntax, improve :echo and :execute highlighting (https://github.com/vim/vim/issues/14199)
Improve :echo and :execute highlighting.
- Add better line-continuation support for both commands.
- Improve the :execute command's expression argument matching.
- Remove the fix for issue #9987 as this is now handled by correctly
matching the parens in :echo (...) as operator parens.
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 15 Mar 2024 14:00:05 +0100 |
parents | 0591aba1489d |
children | 69ab5ebb3d3f |
line wrap: on
line diff
--- a/runtime/syntax/generator/vim.vim.base +++ b/runtime/syntax/generator/vim.vim.base @@ -167,7 +167,7 @@ syn match vimNumber '\%(^\|\A\)\zs#\x\{6 syn case match " All vimCommands are contained by vimIsCommand. {{{2 -syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimEcho,vimEchoHL,vimExecute,vimIsCommand,vimExtCmd,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate +syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,@vimEcho,vimExecute,vimIsCommand,vimExtCmd,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1 syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" contains=vimCommand syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>" @@ -450,15 +450,27 @@ syn match vimAutoCmdMod "\(++\)\=\(once\ " Echo And Execute: -- prefer strings! {{{2 " ================ -" GEN_SYN_VIM: vimCommand echo, START_STR='syn keyword vimEcho', END_STR='skipwhite nextgroup=vimEchoExpr' -syn region vimEchoExpr contained start="[^[:space:]|]" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="|" end="$" contains=@vimContinue,@vimExprList +" NOTE: No trailing comments -syn match vimEchoHL "\<echohl\=\>" skipwhite nextgroup=vimGroup,vimHLGroup,vimEchoHLNone +syn region vimEcho + \ matchgroup=vimCommand + \ start="\<ec\%[ho]\>" + \ start="\<echoe\%[rr]\>" + \ start="\<echom\%[sg]\>" + \ start="\<echoc\%[onsole]\>" + \ start="\<echon\>" + \ start="\<echow\%[indow]\>" + \ skip=+\\|\|\n\s*\\\|\n\s*"\\ + + \ matchgroup=vimCmdSep end="|" excludenl end="$" contains=@vimContinue,@vimExprList transparent + +syn match vimEchohl "\<echohl\=\>" skipwhite nextgroup=vimGroup,vimHLGroup,vimEchohlNone syn case ignore -syn keyword vimEchoHLNone none +syn keyword vimEchohlNone contained none syn case match -syn region vimExecute oneline excludenl matchgroup=vimCommand start="\<exe\%[cute]\>" skip="\(\\\\\)*\\|" end="$\||\|<[cC][rR]>" contains=vimFuncVar,vimIsCommand,vimOper,vimNotation,vimOperParen,vimString,vimVar +syn cluster vimEcho contains=vimEcho.* + +syn region vimExecute matchgroup=vimCommand start="\<exe\%[cute]\>" skip=+\\|\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="|" excludenl end="$" contains=@vimContinue,@vimExprList transparent " Maps: {{{2 " ==== @@ -529,9 +541,8 @@ syn case match " User Function Highlighting: {{{2 " (following Gautam Iyer's suggestion) " ========================== -syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncEcho,vimFuncName,vimUserFunc,vimExecute +syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncName,vimUserFunc,vimExecute syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\<if\>" contains=vimNotation -syn keyword vimFuncEcho contained ec ech echo " User Command Highlighting: {{{2 syn match vimUsrCmd '^\s*\zs\u\%(\w*\)\@>\%([(#[]\|\s\+\%([-+*/%]\=\|\.\.\)=\)\@!' @@ -971,8 +982,8 @@ if !exists("skip_vim_syntax_inits") hi def link vimContinueComment vimComment hi def link vimCtrlChar SpecialChar hi def link vimEcho vimCommand - hi def link vimEchoHLNone vimGroup - hi def link vimEchoHL vimCommand + hi def link vimEchohlNone vimGroup + hi def link vimEchohl vimCommand hi def link vimElseIfErr Error hi def link vimElseif vimCondHL hi def link vimEnvvar PreProc