vim/runtime/syntax/testdir/input/vim9_variables.vim
Doug Kearns 722fbd1554
Some checks are pending
GitHub CI / linux (i386, gcc, normal, ./src/shadow) (push) Waiting to run
GitHub CI / linux (native, clang, [], normal) (push) Waiting to run
GitHub CI / linux (native, clang, [], tiny) (push) Waiting to run
GitHub CI / linux (native, clang, true, [], huge, dynamic, stable-abi) (push) Waiting to run
GitHub CI / linux (native, gcc, [], normal) (push) Waiting to run
GitHub CI / linux (native, gcc, [], tiny) (push) Waiting to run
GitHub CI / linux (native, gcc, true, [], huge) (push) Waiting to run
GitHub CI / linux (arm64, gcc, [nogui], tiny) (push) Waiting to run
GitHub CI / linux (arm64, gcc, true, [unittests], huge) (push) Waiting to run
GitHub CI / linux (clang, [asan], huge, 5.1) (push) Waiting to run
GitHub CI / linux (clang, [nogui], tiny) (push) Waiting to run
GitHub CI / linux (gcc, [nogui], tiny) (push) Waiting to run
GitHub CI / linux (gcc, [vimtags], normal) (push) Waiting to run
GitHub CI / linux (gcc, true, [uchar testgui], huge, dynamic) (push) Waiting to run
GitHub CI / linux (gcc, true, [unittests], huge) (push) Waiting to run
GitHub CI / macos (huge, macos-13) (push) Waiting to run
GitHub CI / macos (huge, macos-15) (push) Waiting to run
GitHub CI / macos (normal, macos-13) (push) Waiting to run
GitHub CI / macos (normal, macos-15) (push) Waiting to run
GitHub CI / macos (tiny, macos-13) (push) Waiting to run
GitHub CI / macos (tiny, macos-15) (push) Waiting to run
GitHub CI / windows (no, no, x64, HUGE, stable, msvc) (push) Waiting to run
GitHub CI / windows (no, no, x86, TINY, mingw) (push) Waiting to run
GitHub CI / windows (no, yes, x64, yes, HUGE, mingw) (push) Waiting to run
GitHub CI / windows (no, yes, x86, NORMAL, msvc) (push) Waiting to run
GitHub CI / windows (yes, no, x64, NORMAL, mingw) (push) Waiting to run
GitHub CI / windows (yes, no, x86, HUGE, msvc) (push) Waiting to run
GitHub CI / windows (yes, yes, x64, TINY, msvc) (push) Waiting to run
GitHub CI / windows (yes, yes, x86, yes, HUGE, stable, mingw) (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
runtime(vim): Update base-syntax, match tuples
Tuples were introduced in commit 9cb865e.  See PR #16776.

fixes: #16965
closes: #16935

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-03-28 19:36:37 +01:00

240 lines
3.3 KiB
VimL

vim9script
# Vim9 variable highlighting
# Declarations
var foo = expr
b:foo = expr
g:foo = expr
t:foo = expr
w:foo = expr
v:true = expr
$FOO = expr
var [foo, bar] = expr
var [foo,
\ bar] = expr
var [$foo, $bar] = expr
var [$foo,
\ $bar] = expr
var [foo, bar; baz] = expr
var [foo,
\ bar;
\ baz] = expr
var [$foo, $bar; $baz] = expr
var [$foo,
\ $bar;
\ $baz] = expr
var foo =<< END
...
END
var foo =<< trim END
...
END
var foo =<< eval END
...
END
var foo =<< trim eval END
...
END
var foo =<< eval trim END
...
END
# Typed declarations
var foo: tuple<any> = expr
var foo: tuple<number> = expr
var foo: tuple<number, string, bool> = expr
var foo: tuple<...list<any>> = expr
var foo: tuple<...list<number>> = expr
var foo: tuple<number, ...list<string>> = expr
var foo: tuple<
#\ comment
\number,
#\ comment
\string,
#\ comment
\bool
\>
# Assignments
foo = expr
foo[0] = expr
foo[1:2] = expr
foo[:2] = expr
foo[1:] = expr
foo[:] = expr
foo["key"] = expr
foo['key'] = expr
foo += expr
foo -= expr
foo *= expr
foo /= expr
foo %= expr
foo ..= expr
b:foo = expr
g:foo = expr
t:foo = expr
w:foo = expr
b:foo += expr
g:foo += expr
t:foo += expr
w:foo += expr
b:foo -= expr
g:foo -= expr
t:foo -= expr
w:foo -= expr
b:foo *= expr
g:foo *= expr
t:foo *= expr
w:foo *= expr
b:foo /= expr
g:foo /= expr
t:foo /= expr
w:foo /= expr
b:foo %= expr
g:foo %= expr
t:foo %= expr
w:foo %= expr
b:foo ..= expr
g:foo ..= expr
t:foo ..= expr
w:foo ..= expr
$FOO = expr
$FOO ..= expr
@f = expr
@f ..= expr
&ari = expr
&t_k1 = "\<Esc>[234;"
&ari ..= expr
&ari += expr
&ari -= expr
&l:aleph = expr
&l:aleph ..= expr
&l:aleph += expr
&l:aleph -= expr
&g:aleph = expr
&g:aleph ..= expr
&g:aleph += expr
&g:aleph -= 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
[@a, @b] = expr
[@a,
\ @a] = expr
[foo, bar] ..= expr
[foo, bar] += expr
[foo, bar] -= expr
[foo, bar] *= expr
[foo, bar] /= expr
[foo, bar] %= expr
[foo, bar; baz] = expr
[foo,
\ bar;
\ baz] = expr
[v:true, v:false; v:none] = expr
[v:true,
\ v:false;
\ v:none] = expr
[$foo, $bar; $baz] = expr
[$foo,
\ $bar;
\ $baz] = expr
[&ari, &bkc; &cmp] = expr
[&ari,
\ &bkc;
\ &cmp] = expr
[@a, @b; @c] = expr
[@a,
\ @b;
\ @c] = expr
foo =<< END
...
END
foo =<< trim END
...
END
foo =<< eval END
...
END
foo =<< trim eval END
...
END
foo =<< eval trim END
...
END
# :for
for foo in expr
endfor
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