runtime(vim): Update base syntax, fix Vim9 :for loop variable highlighting
Commit:
https://github.com/vim/vim/commit/6f97624e115eb793e5b486244683ecb86959d859
Author: Doug Kearns <
dougk...@gmail.com>
Date: Sun Aug 31 19:13:32 2025 +0200
runtime(vim): Update base syntax, fix Vim9 :for loop variable highlighting
Highlight the iteration variable's type in Vim9 :for {var} loops.
Reported by Aliaksei Budavei.
fixes: #17961
closes: #18163
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 9f5781c2f..2d89ce5ca 100644
--- a/runtime/syntax/generator/vim.vim.base
+++ b/runtime/syntax/generator/vim.vim.base
@@ -1172,7 +1172,7 @@ syn region vimFor
\ matchgroup=vimCommand
\ start="\<for\>" end="\<in\>"
\ skipwhite skipnl nextgroup=@vimForInContinue,vim9ForInComment,@vimExprList
- \ contains=@vimContinue,vimVar,vimVarList,vim9VariableList
+ \ contains=@vimContinue,vimVar,vimVarList,vim9Variable,vim9VariableList
\ transparent
syn match vim9ForInComment contained "#.*" skipwhite skipempty nextgroup=vimForInComment,@vimExprList
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_for_01.dump b/runtime/syntax/testdir/dumps/vim9_ex_for_01.dump
index 5cf763707..1335c9fa7 100644
--- a/runtime/syntax/testdir/dumps/vim9_ex_for_01.dump
+++ b/runtime/syntax/testdir/dumps/vim9_ex_for_01.dump
@@ -15,6 +15,6 @@
@75
|f+0#af5f00255&|o|r| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|i+0#af5f00255&|n| +0#0000000&|[+0#e000e06&|4+0#e000002&|2|]+0#e000e06&| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&||| |e+0#af5f00255&|n|d|f|o|r| +0#0000000&@39
@75
-|f+0#af5f00255&|o|r| +0#0000000&|f+0#00e0e07&|o@1|:+0#0000000&| |n+0#00e0e07&|u|m|b|e|r| +0#0000000&|i+0#af5f00255&|n| +0#0000000&|[+0#e000e06&|4+0#e000002&|2|]+0#e000e06&| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&||| |e+0#af5f00255&|n|d|f|o|r| +0#0000000&@31
+|f+0#af5f00255&|o|r| +0#0000000&|f+0#00e0e07&|o@1|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r| +0#0000000&|i+0#af5f00255&|n| +0#0000000&|[+0#e000e06&|4+0#e000002&|2|]+0#e000e06&| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&||| |e+0#af5f00255&|n|d|f|o|r| +0#0000000&@31
@75
-@57|1|9|,|7| @9|2|7|%|
+@57|1|9|,|7| @9|1|8|%|
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_for_02.dump b/runtime/syntax/testdir/dumps/vim9_ex_for_02.dump
index 9e60ec45b..9b0f7f186 100644
--- a/runtime/syntax/testdir/dumps/vim9_ex_for_02.dump
+++ b/runtime/syntax/testdir/dumps/vim9_ex_for_02.dump
@@ -17,4 +17,4 @@
|e+0#af5f00255&|n|d|f|o|r| +0#0000000&@68
@75
|f+0#af5f00255&|o|r| +0#0000000&|[|f+0#00e0e07&|o@1|,+0#0000000&| |b+0#00e0e07&|a|r|]+0#0000000&| |i+0#af5f00255&|n| +0#0000000&@57
-@57|3|7|,|0|-|1| @7|6|4|%|
+@57|3|7|,|0|-|1| @7|4@1|%|
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_for_03.dump b/runtime/syntax/testdir/dumps/vim9_ex_for_03.dump
index 1aecb92bb..7b813bc34 100644
--- a/runtime/syntax/testdir/dumps/vim9_ex_for_03.dump
+++ b/runtime/syntax/testdir/dumps/vim9_ex_for_03.dump
@@ -16,5 +16,5 @@
@2|e+0#af5f00255&|c|h|o| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|b+0#00e0e07&|a|r| +0#0000000&@60
|e+0#af5f00255&|n|d|f|o|r| +0#0000000&@68
@75
-|~+0#4040ff13&| @73
-| +0#0000000&@56|5@1|,|0|-|1| @7|B|o|t|
+@75
+@57|5@1|,|0|-|1| @7|7|1|%|
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_for_04.dump b/runtime/syntax/testdir/dumps/vim9_ex_for_04.dump
new file mode 100644
index 000000000..9d4db8f91
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_for_04.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@74
+|#+0#0000e05&| |I|s@1|u|e| |#|7|9|6|1| |(|B|u|i|l|t|i|n| |t|y|p|e|s| |a|r|e| |n|o|t| |h|i|g|h|l|i|g|h|t|e|d| |i|n| |i|t|e|m|-|v|a|r|i|a|b|l|e| |d|e|c|l|a|r|a|t|i
+|o|n|s| +0#0000000&@71
+|#+0#0000e05&| @13|o|f| |:|f|o|r| |c|o|m@1|a|n|d|s|)| +0#0000000&@42
+@75
+>v+0#af5f00255&|a|r| +0#0000000&|m+0#00e0e07&|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r| +0#0000000&@61
+|v+0#af5f00255&|a|r| +0#0000000&|n+0#00e0e07&|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r| +0#0000000&@61
+|f+0#af5f00255&|o|r| +0#0000000&|x+0#00e0e07&|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r| +0#0000000&|i+0#af5f00255&|n| +0#0000000&|r+0#00e0e07&|a|n|g|e|(+0#e000e06&|2+0#e000002&|)+0#e000e06&| +0#0000000&||| |m+0#af5f00255&| +0#0000000&|=+0#af5f00255&| +0#0000000&|x+0#00e0e07&| +0#0000000&||| |e+0#af5f00255&|n|d|f|o|r| +0#0000000&@32
+|#+0#0000e05&@5| |^@5| +0#0000000&@61
+|e+0#af5f00255&|c|h|o| +0#0000000&|m+0#00e0e07&| +0#0000000&@68
+|f+0#af5f00255&|o|r| +0#0000000&|[|x+0#00e0e07&|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r|,+0#0000000&| |y+0#00e0e07&|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r|]+0#0000000&| |i+0#af5f00255&|n| +0#0000000&|[+0#e000e06&@1|0+0#e000002&|,+0#0000000&| |0+0#e000002&|]+0#e000e06&|,+0#0000000&| |[+0#e000e06&|1+0#e000002&|,+0#0000000&| |1+0#e000002&|]+0#e000e06&@1| +0#0000000&||| |[|m+0#00e0e07&|,+0#0000000&| |n+0#00e0e07&|]+0#0000000&| |=+0#af5f00255&| +0#0000000&|[+0#e000e06&|x+0#00e0e07&|,+0#0000000&| |y+0#00e0e07&|]+0#e000e06&| +0#0000000&||| |e+0#af5f00255&|n|d|f|o|r| +0#0000000&@1
+|e+0#af5f00255&|c|h|o| +0#0000000&|m+0#00e0e07&| +0#0000000&|n+0#00e0e07&| +0#0000000&@66
+@75
+|v+0#af5f00255&|a|r| +0#0000000&|F+0#00e0e07&|:+0#0000000&| |f+0#00e0003&|u|n|c| +0#0000000&@63
+|f+0#af5f00255&|o|r| +0#0000000&|t+0#00e0e07&|:+0#0000000&| |t+0#00e0003&|u|p|l|e|<|f|u|n|c|>| +0#0000000&|i+0#af5f00255&|n| +0#0000000&|(+0#e000e06&@1|f+0#00e0e07&|u|n|c|t|i|o|n|(+0#e000e06&|'+0#e000002&|t|o|l|o|w|e|r|'|)+0#e000e06&|,+0#0000000&|)+0#e000e06&|,+0#0000000&|)+0#e000e06&| +0#0000000&||| |F| |=+0#af5f00255&| +0#0000000&|t+0#00e0e07&|[+0#0000000&|0+0#e000002&|]+0#0000000&| ||| |e+0#af5f00255&|n|d|f|o|r| +0#0000000&@7
+|#+0#0000e05&@5| |^@10| +0#0000000&@56
+|e+0#af5f00255&|c|h|o| +0#0000000&|F|(+0#e000e06&|'+0#e000002&|H|E|L@1|O|'|)+0#e000e06&| +0#0000000&@59
+|f+0#af5f00255&|o|r| +0#0000000&|[|L+0#00e0e07&|:+0#0000000&| |f+0#00e0003&|u|n|c|,+0#0000000&| |U+0#00e0e07&|:+0#0000000&| |f+0#00e0003&|u|n|c|]+0#0000000&| |i+0#af5f00255&|n| +0#0000000&|[+0#e000e06&@1|f+0#00e0e07&|u|n|c|t|i|o|n|(+0#e000e06&|'+0#e000002&|t|o|l|o|w|e|r|'|)+0#e000e06&|,+0#0000000&| |f+0#00e0e07&|u|n|c|t|i|o|n|(+0#e000e06&|'+0#e000002&|t|o|u|p@1|e|r|'|)+0#e000e06&|]@1| +0#0000000&@4
+@4|[|_+0#00e0e07&|,+0#0000000&| |F+0#00e0e07&|]+0#0000000&| |=+0#af5f00255&| +0#0000000&|[+0#e000e06&|L+0#00e0e07&|,+0#0000000&| |U+0#00e0e07&|]+0#e000e06&| +0#0000000&@55
+@57|7|2|,|1| @9|9|5|%|
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_for_05.dump b/runtime/syntax/testdir/dumps/vim9_ex_for_05.dump
new file mode 100644
index 000000000..8e6c2e7d3
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_for_05.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@3|[|_+0#00e0e07&|,+0#0000000&| |F+0#00e0e07&|]+0#0000000&| |=+0#af5f00255&| +0#0000000&|[+0#e000e06&|L+0#00e0e07&|,+0#0000000&| |U+0#00e0e07&|]+0#e000e06&| +0#0000000&@55
+|e+0#af5f00255&|n|d|f|o|r| +0#0000000&@68
+|e+0#af5f00255&|c|h|o| +0#0000000&|F|(+0#e000e06&|'+0#e000002&|h|e|l@1|o|'|)+0#e000e06&| +0#0000000&|F|(+0#e000e06&|'+0#e000002&|w|o|r|l|d|'|)+0#e000e06&| +0#0000000&@48
+> @74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|8@1|,|0|-|1| @7|B|o|t|
diff --git a/runtime/syntax/testdir/input/vim9_ex_for.vim b/runtime/syntax/testdir/input/vim9_ex_for.vim
index e01afc6c4..f23b3cc50 100644
--- a/runtime/syntax/testdir/input/vim9_ex_for.vim
+++ b/runtime/syntax/testdir/input/vim9_ex_for.vim
@@ -65,3 +65,24 @@ for [foo: number, bar: number] in expr2
echo foo bar
endfor
+
+# Issue #7961 (Builtin types are not highlighted in item-variable declarations
+# of :for commands)
+
+var m: number
+var n: number
+for x: number in range(2) | m = x | endfor
+###### ^^^^^^
+echo m
+for [x: number, y: number] in [[0, 0], [1, 1]] | [m, n] = [x, y] | endfor
+echo m n
+
+var F: func
+for t: tuple<func> in ((function('tolower'),),) | F = t[0] | endfor
+###### ^^^^^^^^^^^
+echo F('HELLO')
+for [L: func, U: func] in [[function('tolower'), function('toupper')]]
+ [_, F] = [L, U]
+endfor
+echo F('hello') F('world')
+
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 101cf3508..3b1afa8c1 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -1228,7 +1228,7 @@ syn region vimFor
\ matchgroup=vimCommand
\ start="\<for\>" end="\<in\>"
\ skipwhite skipnl nextgroup=@vimForInContinue,vim9ForInComment,@vimExprList
- \ contains=@vimContinue,vimVar,vimVarList,vim9VariableList
+ \ contains=@vimContinue,vimVar,vimVarList,vim9Variable,vim9VariableList
\ transparent
syn match vim9ForInComment contained "#.*" skipwhite skipempty nextgroup=vimForInComment,@vimExprList