aboutsummaryrefslogtreecommitdiff
path: root/runtime/syntax/vim.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-01-21 08:10:14 +0800
committerGitHub <noreply@github.com>2025-01-21 00:10:14 +0000
commit05435bf10585e7f850ff44acd63446fbcc56bfe5 (patch)
treed89b3bde260f2c60f8a7cb7ed142f7bfd623914d /runtime/syntax/vim.vim
parent855a2a75e6f7d08376c221a46e0179e5c76176ec (diff)
downloadrneovim-05435bf10585e7f850ff44acd63446fbcc56bfe5.tar.gz
rneovim-05435bf10585e7f850ff44acd63446fbcc56bfe5.tar.bz2
rneovim-05435bf10585e7f850ff44acd63446fbcc56bfe5.zip
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 https://github.com/vim/vim/commit/c273f1ac770e86767206c8193bab659b25d3b41b Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Diffstat (limited to 'runtime/syntax/vim.vim')
-rw-r--r--runtime/syntax/vim.vim18
1 files changed, 13 insertions, 5 deletions
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 4038a65440..c4e231d145 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -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 match vimOper "\a\@<!!" 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 "\%#=1\%(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\)[?#]\=" 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 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 vimFuncBodyList contains=@vimFuncBodyCommon,vimComment,vimLineComment,vimFuncVar,vimInsert,vimConst,vimLet
-syn cluster vimDefBodyList contains=@vimFuncBodyCommon,vim9Comment,vim9LineComment,vim9Const,vim9Final,vim9Var,vim9Null,vim9Boolean,vim9For
+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,vimSearch
+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 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
" ====================
-syn match vimSearch '^\s*[/?].*' contains=vimSearchDelim
+VimL syn match vimSearch '^\s*[/?].*' contains=vimSearchDelim
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='\<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 vimRegister SpecialChar
hi def link vimScriptDelim Comment
- hi def link vimSearchDelim Statement
hi def link vimSearch vimString
+ hi def link vimSearchDelim Delimiter
hi def link vimSep Delimiter
hi def link vimSet vimCommand
hi def link vimSetAll vimOption
@@ -1500,6 +1506,8 @@ if !exists("skip_vim_syntax_inits")
hi def link vim9MethodNameError vimFunctionError
hi def link vim9Null Constant
hi def link vim9Public vimCommand
+ hi def link vim9Search vimString
+ hi def link vim9SearchDelim Delimiter
hi def link vim9Static vimCommand
hi def link vim9Super Identifier
hi def link vim9This Identifier