runtime(vim): Update base syntax, fix mismtatched :def return type
Commit:
https://github.com/vim/vim/commit/dfdeba16d7930e4a1fb8cf0003656b13da8ffffc
Author: Doug Kearns <
dougk...@gmail.com>
Date: Mon May 25 16:33:27 2026 +0000
runtime(vim): Update base syntax, fix mismtatched :def return type
Anchor the return type separator ':' with a lookbehind as the relevant
nextgroup options use skipwhite.
closes: #20319
Signed-off-by: Doug Kearns <
dougk...@gmail.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base
index 24a51167a..48414714f 100644
--- a/runtime/syntax/generator/vim.vim.base
+++ b/runtime/syntax/generator/vim.vim.base
@@ -2,7 +2,7 @@
" Language: Vim script
" Maintainer: Hirohito Higashi <h.east.727 ATMARK
gmail.com>
" Doug Kearns <
dougk...@gmail.com>
-" Last Change: 2026 Feb 20
+" Last Change: 2026 May 24
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -520,7 +520,7 @@ syn match vim9LambdaParams contained
\ "(\%(\<func(\|[^(]\)*\%(
\s*\\%(\<func(\|[^(]\)*\|
\s*#\ .*\)*\ze\s\+=>"
\ skipwhite nextgroup=vim9LambdaOperator
\ contains=@vim9Continue,vimDefParam,vim9LambdaParen,vim9LambdaReturnType
-syn region vim9LambdaReturnType contained start=")\@<=:\s" end="\ze\s*#" end="\ze\s*=>" contains=@vim9Continue,@vimType transparent
+syn region vim9LambdaReturnType contained start=")\@1<=:\s" end="\ze\s*#" end="\ze\s*=>" contains=@vim9Continue,@vimType transparent
syn region vim9LambdaBlock contained matchgroup=vimSep start="{" end="^\s*\zs}" contains=@vimDefBodyList
syn match vim9LambdaOperatorComment contained "#.*" skipwhite skipempty nextgroup=@vimExprList,vim9LambdaBlock,vim9LambdaOperatorComment
@@ -630,7 +630,7 @@ syn match vimDelfunction "\<delf\%[unction]\>" skipwhite nextgroup=vimDelfunct
" =====
syn region vimReturnType contained
- \ start=":\%(\s\|
\)\@="
+ \ start=")\@1<=:\%(\s\|
\)\@="
\ skip=+
\s*\%(\\|#\ \)\|^\s*#\ +
\ end="$"
\ matchgroup=vim9Comment
@@ -697,7 +697,7 @@ if s:vim9script
\ contains=vim9DefTypeParam
syn region vim9MethodDefReturnType contained
- \ start=":\%(\s\|
\)\@="
+ \ start=")\@1<=:\%(\s\|
\)\@="
\ skip=+
\s*\%(\\|#\ \)\|^\s*#\ +
\ end="$"
\ matchgroup=vim9Comment
@@ -825,7 +825,7 @@ if s:vim9script
\ skipwhite skipnl nextgroup=vimDefComment,vim9AbstractDefReturnType,vimCommentError
\ contains=vimDefParam,vim9Comment,vimFunctionParamEquals
syn region vim9AbstractDefReturnType contained
- \ start=":\s" end="$" matchgroup=vim9Comment end="\ze[#"]"
+ \ start=")\@1<=:\s" end="$" matchgroup=vim9Comment end="\ze[#"]"
\ skipwhite skipnl nextgroup=vimDefComment,vimCommentError
\ contains=vimTypeSep
\ transparent
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_01.dump b/runtime/syntax/testdir/dumps/vim_ex_def_01.dump
index f13f4f4e3..92211445a 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_def_01.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_01.dump
@@ -17,4 +17,4 @@
@75
|d+0#af5f00255&|e|f| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@55
|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
-@57|1|9|,|1| @9|1|2|%|
+@57|1|9|,|1| @9|1@1|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_02.dump b/runtime/syntax/testdir/dumps/vim_ex_def_02.dump
index 14cffbda0..0f575f843 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_def_02.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_02.dump
@@ -17,4 +17,4 @@
|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
@75
|d+0#af5f00255&|e|f| +0#0000000&|<+0#e000e06&|S|I|D|>|F+0#0000000&|o@1|(+0#e000e06&|)|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r| +0#0000000&@52
-@57|3|7|,|0|-|1| @7|2|8|%|
+@57|3|7|,|0|-|1| @7|2|7|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_03.dump b/runtime/syntax/testdir/dumps/vim_ex_def_03.dump
index 4ab6ef5e9..3c325f480 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_def_03.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_03.dump
@@ -17,4 +17,4 @@
|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
@75
|d+0#af5f00255&|e|f| +0#0000000&|F|o@1|(+0#e000e06&|)|:+0#0000000&| |v+0#00e0003&|o|i|d| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@49
-@57|5@1|,|3| @9|4|5|%|
+@57|5@1|,|3| @9|4|2|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_04.dump b/runtime/syntax/testdir/dumps/vim_ex_def_04.dump
index 6b5e93d8d..cccc2bad1 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_def_04.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_04.dump
@@ -17,4 +17,4 @@
@75
|d+0#af5f00255&|e|f| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@65
|e+0#af5f00255&|n|d@1|e|f| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@55
-@57|7|3|,|0|-|1| @7|6|2|%|
+@57|7|3|,|0|-|1| @7|5|8|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_05.dump b/runtime/syntax/testdir/dumps/vim_ex_def_05.dump
index 651922674..56950e93f 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_def_05.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_05.dump
@@ -17,4 +17,4 @@
@75
|"+0#0000e05&| |I|s@1|u|e| |#|1|6|2|4|3| |(|V|i|m| |s|c|r|i|p|t| |d|e|f| |p|a|r|a|m|e|t|e|r|s| |s|y|n|t|a|x| |h|i|g|h|l|i|g|h|t| |i|s| |w|r|o|n|g|)| +0#0000000&@6
@75
-@57|9|0|,|0|-|1| @7|7|8|%|
+@57|9|0|,|0|-|1| @7|7|3|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_06.dump b/runtime/syntax/testdir/dumps/vim_ex_def_06.dump
index 3c4b3ab06..317bb43f3 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_def_06.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_06.dump
@@ -17,4 +17,4 @@
|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
@75
@75
-@57|1|0|8|,|1| @8|9|5|%|
+@57|1|0|8|,|1| @8|8|9|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_07.dump b/runtime/syntax/testdir/dumps/vim_ex_def_07.dump
index 87f3964bd..381b7ae55 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_def_07.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_07.dump
@@ -4,17 +4,17 @@
|s+0#af5f00255&|i|l|e|n|t|!| +0#0000000&|d+0#af5f00255&|e|f| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@57
|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
> @74
+@75
+|"+0#0000e05&| |U|n|r|e|p|o|r|t|e|d| |i|s@1|u|e| |(|r|e|t|u|r|n| |t|y|p|e| |c|o|l|o|n| |m|u|s|t| |f|o|l@1|o|w| |i|m@1|e|d|i|a|t|e|l|y| |a|f|t|e|r| |c|l|o|s|i|n|g
+| |p|a|r|a|m|e|t|e|r|-|l|i|s|t| |p|a|r|e|n|)| +0#0000000&@52
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@65
+|:| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|n|o|t| |a| |m|i|s|m|a|t|c|h|e|d| |r|e|t|u|r|n| |t|y|p|e|"| +0#0000000&@37
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
| +0#0000000&@56|1|2|6|,|0|-|1| @6|B|o|t|
diff --git a/runtime/syntax/testdir/input/vim_ex_def.vim b/runtime/syntax/testdir/input/vim_ex_def.vim
index 7b1d39f4d..a48273f87 100644
--- a/runtime/syntax/testdir/input/vim_ex_def.vim
+++ b/runtime/syntax/testdir/input/vim_ex_def.vim
@@ -124,3 +124,10 @@ enddef
silent! def Foo()
enddef
+
+" Unreported issue (return type colon must follow immediately after closing parameter-list paren)
+
+def Foo()
+: echo "not a mismatched return type"
+enddef
+
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 4c2c137a0..e4538dd8d 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -2,7 +2,7 @@
" Language: Vim script
" Maintainer: Hirohito Higashi <h.east.727 ATMARK
gmail.com>
" Doug Kearns <
dougk...@gmail.com>
-" Last Change: 2026 May 17
+" Last Change: 2026 May 24
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -575,7 +575,7 @@ syn match vim9LambdaParams contained
\ "(\%(\<func(\|[^(]\)*\%(
\s*\\%(\<func(\|[^(]\)*\|
\s*#\ .*\)*\ze\s\+=>"
\ skipwhite nextgroup=vim9LambdaOperator
\ contains=@vim9Continue,vimDefParam,vim9LambdaParen,vim9LambdaReturnType
-syn region vim9LambdaReturnType contained start=")\@<=:\s" end="\ze\s*#" end="\ze\s*=>" contains=@vim9Continue,@vimType transparent
+syn region vim9LambdaReturnType contained start=")\@1<=:\s" end="\ze\s*#" end="\ze\s*=>" contains=@vim9Continue,@vimType transparent
syn region vim9LambdaBlock contained matchgroup=vimSep start="{" end="^\s*\zs}" contains=@vimDefBodyList
syn match vim9LambdaOperatorComment contained "#.*" skipwhite skipempty nextgroup=@vimExprList,vim9LambdaBlock,vim9LambdaOperatorComment
@@ -685,7 +685,7 @@ syn match vimDelfunction "\<delf\%[unction]\>" skipwhite nextgroup=vimDelfunct
" =====
syn region vimReturnType contained
- \ start=":\%(\s\|
\)\@="
+ \ start=")\@1<=:\%(\s\|
\)\@="
\ skip=+
\s*\%(\\|#\ \)\|^\s*#\ +
\ end="$"
\ matchgroup=vim9Comment
@@ -752,7 +752,7 @@ if s:vim9script
\ contains=vim9DefTypeParam
syn region vim9MethodDefReturnType contained
- \ start=":\%(\s\|
\)\@="
+ \ start=")\@1<=:\%(\s\|
\)\@="
\ skip=+
\s*\%(\\|#\ \)\|^\s*#\ +
\ end="$"
\ matchgroup=vim9Comment
@@ -880,7 +880,7 @@ if s:vim9script
\ skipwhite skipnl nextgroup=vimDefComment,vim9AbstractDefReturnType,vimCommentError
\ contains=vimDefParam,vim9Comment,vimFunctionParamEquals
syn region vim9AbstractDefReturnType contained
- \ start=":\s" end="$" matchgroup=vim9Comment end="\ze[#"]"
+ \ start=")\@1<=:\s" end="$" matchgroup=vim9Comment end="\ze[#"]"
\ skipwhite skipnl nextgroup=vimDefComment,vimCommentError
\ contains=vimTypeSep
\ transparent