vim-patch:c273f1a: runtime(vim): Update base-syntax, match ternary and falsy operators (#32132)

fixes: vim/vim#14423
fixes: vim/vim#16227
closes: vim/vim#16484

c273f1ac77

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
This commit is contained in:
zeertzjq 2025-01-21 08:10:14 +08:00 committed by GitHub
parent 855a2a75e6
commit 05435bf105
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -276,6 +276,10 @@ syn keyword vimAugroupKey contained aug[roup] skipwhite nextgroup=vimAugroupBan
syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimRegister,@vimContinue,vim9Comment,vimVar,vimBoolean,vimNull syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimRegister,@vimContinue,vim9Comment,vimVar,vimBoolean,vimNull
syn match vimOper "\a\@<!!" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "\a\@<!!" skipwhite nextgroup=vimString,vimSpecFile
syn match vimOper "||\|&&\|[-+*/%.]" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "||\|&&\|[-+*/%.]" skipwhite nextgroup=vimString,vimSpecFile
syn match vimOper "?" skipwhite nextgroup=@vimExprList
" distinguish ternary : from ex-colon
syn match vimOper "\s\@1<=:\ze\s\|\s\@1<=:$" skipwhite nextgroup=@vimExprList
syn match vimOper "??" skipwhite nextgroup=@vimExprList
syn match vimOper "=" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "=" skipwhite nextgroup=vimString,vimSpecFile
syn match vimOper "\%#=1\%(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\)[?#]\=" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "\%#=1\%(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\)[?#]\=" skipwhite nextgroup=vimString,vimSpecFile
syn match vimOper "\<is\%(not\)\=\>" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "\<is\%(not\)\=\>" skipwhite nextgroup=vimString,vimSpecFile
@ -291,9 +295,9 @@ endif
syn cluster vimFuncList contains=vimFuncBang,vimFunctionError,vimFuncKey,vimFuncSID,Tag syn cluster vimFuncList contains=vimFuncBang,vimFunctionError,vimFuncKey,vimFuncSID,Tag
syn cluster vimDefList contains=vimFuncBang,vimFunctionError,vimDefKey,vimFuncSID,Tag syn cluster vimDefList contains=vimFuncBang,vimFunctionError,vimDefKey,vimFuncSID,Tag
syn cluster vimFuncBodyCommon contains=@vimCmdList,vimCmplxRepeat,vimContinue,vimCtrlChar,vimDef,vimEnvvar,vimFBVar,vimFunc,vimFunction,vimLetHereDoc,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegister,vimSearch,vimSpecFile,vimString,vimSubst,vimFuncFold,vimDefFold syn cluster vimFuncBodyCommon contains=@vimCmdList,vimCmplxRepeat,vimContinue,vimCtrlChar,vimDef,vimEnvvar,vimFBVar,vimFunc,vimFunction,vimLetHereDoc,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegister,vimSpecFile,vimString,vimSubst,vimFuncFold,vimDefFold
syn cluster vimFuncBodyList contains=@vimFuncBodyCommon,vimComment,vimLineComment,vimFuncVar,vimInsert,vimConst,vimLet syn cluster vimFuncBodyList contains=@vimFuncBodyCommon,vimComment,vimLineComment,vimFuncVar,vimInsert,vimConst,vimLet,vimSearch
syn cluster vimDefBodyList contains=@vimFuncBodyCommon,vim9Comment,vim9LineComment,vim9Const,vim9Final,vim9Var,vim9Null,vim9Boolean,vim9For syn cluster vimDefBodyList contains=@vimFuncBodyCommon,vim9Comment,vim9LineComment,vim9Const,vim9Final,vim9Var,vim9Null,vim9Boolean,vim9For,vim9Search
syn region vimFuncPattern contained matchgroup=vimOper start="/" end="$" contains=@vimSubstList syn region vimFuncPattern contained matchgroup=vimOper start="/" end="$" contains=@vimSubstList
syn match vimFunction "\<fu\%[nction]\>" skipwhite nextgroup=vimCmdSep,vimComment,vimFuncPattern contains=vimFuncKey syn match vimFunction "\<fu\%[nction]\>" skipwhite nextgroup=vimCmdSep,vimComment,vimFuncPattern contains=vimFuncKey
@ -1019,8 +1023,10 @@ syn match vim9CommentTitleLeader '#\s\+'ms=s+1 contained
" Searches And Globals: {{{2 " Searches And Globals: {{{2
" ==================== " ====================
syn match vimSearch '^\s*[/?].*' contains=vimSearchDelim VimL syn match vimSearch '^\s*[/?].*' contains=vimSearchDelim
syn match vimSearchDelim '^\s*\zs[/?]\|[/?]$' contained syn match vimSearchDelim '^\s*\zs[/?]\|[/?]$' contained
Vim9 syn match vim9Search '^\s*:[/?].*' contains=vim9SearchDelim
syn match vim9SearchDelim '^\s*\zs:[/?]\|[/?]$' contained contains=vimCmdSep
syn region vimGlobal matchgroup=Statement start='\<g\%[lobal]!\=/' skip='\\.' end='/' skipwhite nextgroup=vimSubst1 syn region vimGlobal matchgroup=Statement start='\<g\%[lobal]!\=/' skip='\\.' end='/' skipwhite nextgroup=vimSubst1
syn region vimGlobal matchgroup=Statement start='\<v\%[global]!\=/' skip='\\.' end='/' skipwhite nextgroup=vimSubst1 syn region vimGlobal matchgroup=Statement start='\<v\%[global]!\=/' skip='\\.' end='/' skipwhite nextgroup=vimSubst1
@ -1406,8 +1412,8 @@ if !exists("skip_vim_syntax_inits")
hi def link vimQuoteEscape vimEscape hi def link vimQuoteEscape vimEscape
hi def link vimRegister SpecialChar hi def link vimRegister SpecialChar
hi def link vimScriptDelim Comment hi def link vimScriptDelim Comment
hi def link vimSearchDelim Statement
hi def link vimSearch vimString hi def link vimSearch vimString
hi def link vimSearchDelim Delimiter
hi def link vimSep Delimiter hi def link vimSep Delimiter
hi def link vimSet vimCommand hi def link vimSet vimCommand
hi def link vimSetAll vimOption hi def link vimSetAll vimOption
@ -1500,6 +1506,8 @@ if !exists("skip_vim_syntax_inits")
hi def link vim9MethodNameError vimFunctionError hi def link vim9MethodNameError vimFunctionError
hi def link vim9Null Constant hi def link vim9Null Constant
hi def link vim9Public vimCommand hi def link vim9Public vimCommand
hi def link vim9Search vimString
hi def link vim9SearchDelim Delimiter
hi def link vim9Static vimCommand hi def link vim9Static vimCommand
hi def link vim9Super Identifier hi def link vim9Super Identifier
hi def link vim9This Identifier hi def link vim9This Identifier