runtime(vim): Update base-syntax and generator, only match valid predefined variables
- Only match valid predefined and option variables.
- Match scope dictionaries.
- Highlight scope prefixed variables as a scope dictionary accessor. The
vimVarScope syntax group can be linked to vimVar to disable this.
- Include support for Neovim-only predefined and option variables.
Temporary collateral damage - scope dictionaries match instead of keys
in dictionary literals.
closes: #16727
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/syntax/testdir/input/vim9_variables.vim b/runtime/syntax/testdir/input/vim9_variables.vim
index 88dfb58..14b1d1d 100644
--- a/runtime/syntax/testdir/input/vim9_variables.vim
+++ b/runtime/syntax/testdir/input/vim9_variables.vim
@@ -11,7 +11,7 @@
t:foo = expr
w:foo = expr
-v:foo = expr
+v:true = expr
$FOO = expr
@@ -58,6 +58,9 @@
foo[1:] = expr
foo[:] = expr
+foo["key"] = expr
+foo['key'] = expr
+
foo += expr
foo -= expr
foo *= expr
@@ -106,36 +109,36 @@
@f = expr
@f ..= expr
-&foo = expr
+&ari = expr
&t_k1 = "\<Esc>[234;"
-&foo ..= expr
+&ari ..= expr
-&foo += expr
-&foo -= expr
+&ari += expr
+&ari -= expr
-&l:foo = expr
+&l:aleph = expr
-&l:foo ..= expr
-&l:foo += expr
-&l:foo -= expr
+&l:aleph ..= expr
+&l:aleph += expr
+&l:aleph -= expr
-&g:foo = expr
+&g:aleph = expr
-&g:foo ..= expr
-&g:foo += expr
-&g:foo -= expr
+&g:aleph ..= expr
+&g:aleph += expr
+&g:aleph -= expr
[foo, bar] = expr
[foo,
\ bar] = expr
-[v:foo, v:bar] = expr
-[v:foo,
- \ v:bar] = expr
-[&foo, &bar] = expr
-[&foo,
- \ &bar] = expr
+[v:true, v:false] = expr
+[v:true,
+ \ v:false] = expr
+[&ari, &bkc] = expr
+[&ari,
+ \ &bkc] = expr
[$foo, $bar] = expr
[$foo,
\ $bar] = expr
@@ -154,18 +157,18 @@
[foo,
\ bar;
\ baz] = expr
-[v:foo, v:bar; v:baz] = expr
-[v:foo,
- \ v:bar;
- \ v:baz] = expr
+[v:true, v:false; v:none] = expr
+[v:true,
+ \ v:false;
+ \ v:none] = expr
[$foo, $bar; $baz] = expr
[$foo,
\ $bar;
\ $baz] = expr
-[&foo, &bar; &baz] = expr
-[&foo,
- \ &bar;
- \ &baz] = expr
+[&ari, &bkc; &cmp] = expr
+[&ari,
+ \ &bkc;
+ \ &cmp] = expr
[@a, @b; @c] = expr
[@a,
\ @b;
@@ -195,3 +198,25 @@
for [foo, bar] in expr
endfor
+# Scope dictionaries
+
+echo get(b:, 'foo', 42)
+echo get(w:, 'foo', 42)
+echo get(t:, 'foo', 42)
+echo get(g:, 'foo', 42)
+echo get(v:, 'foo', 42)
+
+for k in keys(b:) | echo b:[k] | endfor
+for k in keys(w:) | echo w:[k] | endfor
+for k in keys(t:) | echo t:[k] | endfor
+for k in keys(g:) | echo g:[k] | endfor
+for k in keys(v:) | echo v:[k] | endfor
+
+# Neovim-specific variables (not highlighted by default)
+
+echo v:lua v:msgpack_types v:relnum v:stderr v:termrequest v:virtnum
+
+echo &channel &inccommand &mousescroll &pumblend &redrawdebug &scrollback
+echo &shada &shadafile &statuscolumn &termpastefilter &termsync &winbar
+echo &winblend &winhighlight
+