commit 24ecd0c48defac60bd677bf06509181afc5cf07b
parent 82910ddbfbf178468357f18d91ecc36fa06a06c3
Author: zeertzjq <zeertzjq@outlook.com>
Date: Mon, 10 Nov 2025 07:59:51 +0800
vim-patch:59f0ea5: runtime(vim): Update base syntax, match Vim9 object type constructor
fixes: vim/vim#18677.
closes: vim/vim#18691
Reported by Aliaksei Budavei.
https://github.com/vim/vim/commit/59f0ea5b3eb444748c83340f1dcebb182db28b40
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Diffstat:
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
@@ -561,13 +561,20 @@ syn match vimParamType contained ":\s" skipwhite skipnl nextgroup=@vimType conta
syn match vimTypeSep contained ":\%(\s\|\n\)\@=" skipwhite nextgroup=@vimType
syn keyword vimType contained blob bool channel float job number string void
syn keyword vimTypeAny contained any
+syn region vimTypeObject contained
+ \ matchgroup=vimType
+ \ start="\<object<"
+ \ end=">"
+ \ contains=vimTypeAny,vimTypeObject,vimUserType
+ \ oneline
+ \ transparent
syn match vimType contained "\<\%(func\)\>"
syn region vimCompoundType contained matchgroup=vimType start="\<func(" end=")" nextgroup=vimTypeSep contains=@vim9Continue,@vimType transparent
syn region vimCompoundType contained matchgroup=vimType start="\<tuple<" end=">" contains=@vim9Continue,@vimType transparent
syn region vimCompoundType contained matchgroup=vimType start="\<\%(list\|dict\)<" end=">" contains=@vimType oneline transparent
syn match vimUserType contained "\<\%(\h\w*\.\)*\u\w*\>"
-syn cluster vimType contains=vimType,vimTypeAny,vimCompoundType,vimUserType
+syn cluster vimType contains=vimType,vimTypeAny,vimTypeObject,vimCompoundType,vimUserType
" Classes, Enums And Interfaces: {{{2
" =============================
@@ -1118,6 +1125,13 @@ syn region vim9VariableList contained start="\[" end="]" contains=@vimContinue,@
syn match vim9VariableTypeSep contained "\S\@1<=:\%(\s\|\n\)\@=" skipwhite nextgroup=@vim9VariableType
syn keyword vim9VariableType contained blob bool channel float job number string void skipwhite nextgroup=vimLetHeredoc
syn keyword vim9VariableTypeAny contained any skipwhite nextgroup=vimLetHeredoc
+syn region vim9VariableTypeObject contained
+ \ matchgroup=vimType
+ \ start="\<object<"
+ \ end=">"
+ \ contains=vimTypeAny,vimTypeObject,vimUserType
+ \ oneline
+ \ transparent
syn match vim9VariableType contained "\<\%(func\)\>" skipwhite nextgroup=vimLetHeredoc
syn region vim9VariableCompoundType contained
\ matchgroup=vim9VariableType
@@ -1143,7 +1157,7 @@ syn region vim9VariableCompoundType contained
\ transparent
syn match vim9VariableUserType contained "\<\%(\h\w*\.\)*\u\w*\>" skipwhite nextgroup=vimLetHeredoc
-syn cluster vim9VariableType contains=vim9VariableType,vim9VariableTypeAny,vim9VariableCompoundType,vim9VariableUserType
+syn cluster vim9VariableType contains=vim9VariableType,vim9VariableTypeAny,vim9VariableTypeObject,vim9VariableCompoundType,vim9VariableUserType
" Lockvar and Unlockvar: {{{2
" =====================
@@ -2584,6 +2598,7 @@ if !exists("skip_vim_syntax_inits")
hi def link vimTodo Todo
hi def link vimType Type
hi def link vimTypeAny vimType
+ hi def link vimTypeObject vimType
hi def link vimUniq vimCommand
hi def link vimUniqBang vimBang
hi def link vimUniqOptions Special
@@ -2675,7 +2690,8 @@ if !exists("skip_vim_syntax_inits")
hi def link vim9TypeEquals vimOper
hi def link vim9Variable vimVar
hi def link vim9VariableType vimType
- hi def link vim9VariableTypeAny vimType
+ hi def link vim9VariableTypeAny vimTypeAny
+ hi def link vim9VariableTypeObject vimTypeObject
hi def link vim9Var vimCommand
hi def link vim9Vim9ScriptArg Special
hi def link vim9Vim9Script vimCommand