runtime(vim): Cleanup syntax tests

Improve formatting and naming consistency of the syntax tests.

closes: #17850

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Doug Kearns
2025-07-25 20:00:25 +02:00
committed by Christian Brabandt
parent e9d1259111
commit cced80dcbb
555 changed files with 1973 additions and 1787 deletions

View File

@ -1,6 +1,6 @@
vim9script
# Vim9 blocks
# VIM_TESTSETUP set list listchars=tab:> ,trail:-,extends:>,precedes:<,nbsp:+
# VIM_TESTSETUP set list listchars=trail:-
{

View File

@ -1,5 +1,6 @@
vim9script
# Vim9 special methods new*(), empty(), len(), string()
# Vim9 special methods - new*(), empty(), len(), string()
def new()
enddef

View File

@ -1,10 +1,9 @@
vim9script
# Vim |builtin-object-methods| and namesake builtin functions
# VIM_TEST_SETUP hi link vim9MethodName Special
# VIM_TEST_SETUP hi link vim9This Todo
# Vim |builtin-object-methods| and namesake builtin functions.
class PairClassTest
public const a: any
public const b: any
@ -56,3 +55,4 @@ const s2: string = pair.string()
echo b2 && !empty(pair)
echo n2 == 2 && len(pair) == 2
echo s2 == '(0, 1)' && string(pair) == '(0, 1)'

View File

@ -1,8 +1,8 @@
vim9script
# Vim comment strings
# Vim9 comment strings
# VIM_TEST_SETUP let g:vimsyn_comment_strings = v:true
# pre "string" post
function Foo()
@ -20,3 +20,8 @@ command Foo {
autocmd BufNewFile * {
# pre "string" post
}
{
# pre "string" post
}

View File

@ -1,6 +1,6 @@
vim9script
# Vim9 comments
# Vim comments
# Vim9-script comment

View File

@ -1,6 +1,5 @@
vim9script
# Vim9 constructor
# Vim9 constructors
class A

View File

@ -1,8 +1,9 @@
vim9script
# Vim9 function variables
# Vim9 function variable highlighting
def Foo()
# Declarations
var foo = expr

View File

@ -1,8 +1,9 @@
vim9script
# Vim9 :class command
# VIM_TEST_SETUP let g:vimsyn_folding = 'cf'
# VIM_TEST_SETUP let g:vimsyn_folding = 'cfi'
# VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax
interface Interface1
endinterface
interface Interface2

View File

@ -1,7 +1,7 @@
vim9script
# Vim9 Ex commands
# START NOT MATCHED
:@
:@@

View File

@ -1,10 +1,9 @@
vim9script
# Vim :enum command
# Vim9 :enum command
# VIM_TEST_SETUP hi link vim9EnumValue Todo
# See: https://github.com/vim/vim/pull/16365#issuecomment-2571420551
enum Letter
#
#########################################

View File

@ -1,6 +1,6 @@
vim9script
# Vim :enum command
# VIM_TEST_SETUP let g:vimsyn_folding = 'ef'
# Vim9 :enum command
# VIM_TEST_SETUP let g:vimsyn_folding = 'efi'
# VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax
# VIM_TEST_SETUP hi link vim9EnumValue Todo

View File

@ -1,5 +1,4 @@
vim9script
# Vim9 :for command

View File

@ -1,8 +1,8 @@
vim9script
# Vim9 :function and :def tail comment errors
# VIM_TEST_SETUP unlet! g:vimsyn_folding
fun Test1() abort # fun
return 1
endfun # endfun
@ -42,3 +42,4 @@ endfun # endfun
for d in range(1, 6)
exec $'echo Test{d}()'
endfor

View File

@ -1,8 +1,8 @@
vim9script
# Vim9 :function and :def tail comments
# VIM_TEST_SETUP unlet! g:vimsyn_folding
fun Test1() abort " fun
return 1
endfun " endfun
@ -42,3 +42,4 @@ endfun " endfun
for d in range(1, 6)
exec $'echo Test{d}()'
endfor

View File

@ -1,8 +1,9 @@
vim9script
# Vim :interface command
# Vim9 :interface command
# VIM_TEST_SETUP let g:vimsyn_folding = 'i'
# VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax
interface Interface1
endinterface
@ -34,3 +35,4 @@ interface Interface5
def Meth1(): number
def Meth2(): number
endinterface

View File

@ -1,4 +1,5 @@
vim9script
# Vim9 heredoc
# VIM_TEST_SETUP let g:vimsyn_folding = "h"
# VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax

View File

@ -1,6 +1,6 @@
vim9script
# Vim9 :loadkeymap command
# Vim :loadkeymap command
scriptencoding utf-8
@ -24,3 +24,4 @@ c <char-0103> Special notation allowed in RHS - octal
\# <char-0x00a3> Line should not match as a Vim9-script comment
" “ Line should not match as a legacy-script comment
: # Line should not match as a Vim9-script comment

View File

@ -1,5 +1,6 @@
vim9script
# Vim :type command
# Vim9 :type command
type Foo = string
type Bar = list<string>

View File

@ -1,5 +1,5 @@
vim9script
# Vim9-script expressions
# Vim9 expressions
# Number
@ -67,7 +67,7 @@ echo {
# match as keys not scope dictionaries
echo { b: 42, w: 42, t: 42, g: 42, l: 42, s: 42, a: 42, v: 42 }
" Register
# Register
echo @" @@
echo @0 @1 @2 @3 @4 @5 @6 @7 @8 @9

View File

@ -1,14 +1,14 @@
vim9script
# Vim function calls
# VIM_TEST_SETUP highlight link vimUserFunc Todo
# VIM_TEST_SETUP highlight link vim9UserFunc Todo
# Vim9 function calls
# VIM_TEST_SETUP hi link vimUserFunc Todo
# VIM_TEST_SETUP hi link vim9UserFunc Todo
call abs(42)
abs(42)
# command/function distinction
# Command/function distinction
# append browse call chdir confirm copy delete eval execute filter function
# insert join map match mode sort split substitute swapname type
@ -161,7 +161,7 @@ uniq(42)
uniq (42)
# errors
# Errors
var foo = foo(42)
call foo(42)
@ -182,7 +182,7 @@ echo(42)
echo (42)
# expressions
# Expressions
var foo = abs(42)
@ -205,7 +205,7 @@ echo Foo() + bar
echo bar + Foo()
# scope modifiers and qualified names
# Scope modifiers and qualified names
var foo = g:foo(42)
call g:foo(42)
@ -257,7 +257,7 @@ call g:module#foo(42)
g:module#foo(42)
# not builtin functions
# User, not builtin, functions
call g:substitute()
call b:substitute()
@ -294,7 +294,7 @@ substitute#substitute()
g:substitute#substitute()
# chained function calls
# Chained function calls
module.foo().bar()
module.foo().substitute()

View File

@ -1,7 +1,7 @@
vim9script
# VIM_TEST_SETUP highlight link vim9DefTypeParam Todo
# VIM_TEST_SETUP let g:vimsyn_folding = "f"
# VIM_TEST_SETUP let g:vimsyn_folding = "cfi"
# VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax
# VIM_TEST_SETUP hi link vim9DefTypeParam Todo
# See: https://github.com/vim/vim/pull/17313#issuecomment-3046696820 (Aliaksei Budavei)

View File

@ -1,7 +1,7 @@
vim9script
# VIM_TEST_SETUP highlight link vim9DefTypeParam Todo
# VIM_TEST_SETUP let g:vimsyn_folding = "f"
# VIM_TEST_SETUP let g:vimsyn_folding = "cf"
# VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax
# VIM_TEST_SETUP hi link vim9DefTypeParam Todo
# See: https://github.com/vim/vim/pull/17313#issuecomment-3046696820 (Aliaksei Budavei)
# See https://github.com/vim/vim/issues/14330#issuecomment-2028938515 .

View File

@ -1,8 +1,8 @@
vim9script
# Vim9 generic functions
# VIM_TEST_SETUP highlight link vim9DefTypeParam Todo
# VIM_TEST_SETUP let g:vimsyn_folding = "f"
# VIM_TEST_SETUP let g:vimsyn_folding = "cf"
# VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax
# VIM_TEST_SETUP hi link vim9DefTypeParam Todo
# :help generic-functions

View File

@ -1,10 +1,9 @@
vim9script
# Vim9 lambda expressions
# VIM_TEST_SETUP hi link vim9LambdaOperator Todo
# VIM_TEST_SETUP hi link vim9LambdaParen Todo
# Vim 9 lambda expressions
var Foo: func
var expr = 0
@ -72,7 +71,7 @@ Foo = (x: number, ...y: list<number>): list<number> => expr
Foo = (x: number, y: number): list<number> => expr
# post operator comments
# Post-operator comments
Foo = () => # comment
expr
@ -86,7 +85,7 @@ Foo = () =>
expr
# line continuations
# Line continuations
Foo = (x: string,
\ y: number,
@ -112,7 +111,7 @@ Foo = (x: string,
\ number => expr
# funcref call
# Funcref call
echo (() => 42)()
echo ((x: string): number => 42)("foo")

View File

@ -1,3 +1,6 @@
" Vim9 legacy script header
" comment
if !has('vim9script')
@ -14,3 +17,4 @@ vim9script noclear
# string only recognised with leading char
"useless string"

View File

@ -1,4 +1,8 @@
" VIM_TEST_SETUP let g:vimsyn_folding = "H" | set fdm=syntax
" Vim9 legacy script header
" VIM_TEST_SETUP let g:vimsyn_folding = "H"
" VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax
" comment
if !has('vim9script')
@ -15,3 +19,4 @@ vim9script noclear
# string only recognised with leading char
"useless string"

View File

@ -1,8 +1,8 @@
vim9script
# Vim comment strings
# Vim9 no comment strings
# VIM_TEST_SETUP let g:vimsyn_comment_strings = v:false
# pre "string" post
function Foo()
@ -20,3 +20,8 @@ command Foo {
autocmd BufNewFile * {
# pre "string" post
}
{
# pre "string" post
}

View File

@ -1,7 +1,8 @@
#!/usr/bin/env vim -S
vim9script
# Vim9 shebang line
# Vim shebang line
# just a line comment
#!/usr/bin/env vim -S

View File

@ -1,9 +1,9 @@
vim9script
# Vim9 this and super keywords
# VIM_TEST_SETUP hi link vim9This Todo
# VIM_TEST_SETUP hi link vim9Super Todo
def Echo(...args: list<any>)
echo args
enddef

View File

@ -1,5 +1,5 @@
vim9script
# Vim9 this and super keywords
# VIM_TEST_SETUP hi link vim9Super Todo
# VIM_TEST_SETUP hi link vim9This Todo
# See: https://github.com/vim/vim/pull/16476#issuecomment-2638191110

View File

@ -1,5 +1,5 @@
vim9script
# Vim9 this and super keywords
# VIM_TEST_SETUP hi link vim9Super Todo
# VIM_TEST_SETUP hi link vim9This Todo
# See: https://github.com/vim/vim/pull/16476#issuecomment-2635119478

View File

@ -1,7 +1,7 @@
vim9script
# Vim9 variable highlighting
# Declarations
var foo = expr

View File

@ -1,6 +1,7 @@
" Vim comment strings
" VIM_TEST_SETUP let g:vimsyn_comment_strings = v:true
" pre "string" post
function Foo()
@ -18,3 +19,4 @@ command Foo {
autocmd BufNewFile * {
# pre "string" post
}

View File

@ -1,5 +1,6 @@
" Vim comments
" Legacy-script comment
# 42 " comment
@ -70,3 +71,4 @@ endif
def CommentTitle()
# Title: ...
enddef

View File

@ -1,5 +1,6 @@
" Vim :abbreviate commands
abbrev <buffer> foo foobar
cabbrev <buffer> cfoo cfoobar
iabbrev <buffer> ifoo cfoobar
@ -23,3 +24,4 @@ iunabbrev <buffer> ifoo
abclear <buffer>
cabclear <buffer>
iabclear <buffer>

View File

@ -1,7 +1,7 @@
" Vim :augroup command
" VIM_TEST_SETUP let g:vimsyn_folding = "a"
" VIM_TEST_SETUP setl fdc=2 fdl=999 fdm=syntax
" VIM_TEST_SETUP highlight link vimAugroupName Todo
" VIM_TEST_SETUP hi link vimAugroupName Todo
augroup foo

View File

@ -1,6 +1,6 @@
" Vim :autocmd command
" VIM_TEST_SETUP highlight vimAutoCmdGroup Todo
" VIM_TEST_SETUP highlight vimUserAutoEvent Title
" VIM_TEST_SETUP hi link vimAutoCmdGroup Todo
" VIM_TEST_SETUP hi link vimUserAutoEvent Title
" Define
@ -211,7 +211,7 @@ doautocmd <nomodeline> foogroup BufRead *.txt | echo "Foo"
doautocmd <nomodeline> foogroup BufRead *.txt | " comment
" patterns
" Patterns
au BufRead */*.txt

View File

@ -1,7 +1,9 @@
" Vim behave command
" Vim :behave command
behave mswin
behave xterm
behave! mswin
behave! xterm

View File

@ -1,7 +1,7 @@
" Vim :call command
" functions for which there are same-named Ex commands
" Functions with same-named Ex commands
call browse(save, title, initdir, default)
call call(func, arglist, dict)
@ -49,3 +49,4 @@ call Foo(arg1, arg2)
let res = call(func, arglist, dict)
let res = call (func, arglist, dict)

View File

@ -1,5 +1,6 @@
" Vim :catch command
" :help :catch
catch /^Vim:Interrupt$/ " catch interrupts (CTRL-C)
@ -15,3 +16,4 @@ catch " same as /.*/
try | sleep 100 | catch /^Vim:Interrupt$/ | endtry
try | edit | catch /^Vim(edit):E\d\+/ | echo "error" | endtry

View File

@ -1,15 +1,15 @@
" Vim :command, :delcommand and :comclear commands
" VIM_TEST_SETUP highlight link vimUserCmdName Todo
" VIM_TEST_SETUP highlight link vimDelcommandName Todo
" VIM_TEST_SETUP hi link vimUserCmdName Todo
" VIM_TEST_SETUP hi link vimDelcommandName Todo
" list
" List
command
command F
" define
" Define
command Foo echo "Foo"
command! Foo echo "Foo"
@ -53,7 +53,7 @@ def Foo2()
enddef
" multiline define
" Multiline define
command! -addr=lines
\ -bang
@ -112,12 +112,12 @@ command!
\ echo "Bar"
" errors
" Errors
command! -badattr=arguments -bang -badattr -nargs=* Foo echo "Foo"
" delete
" Delete
delcommand Foo
delcommand -buffer Foo

View File

@ -1,4 +1,4 @@
" Vim ex command modifiers
" Vim Ex command modifiers
aboveleft echo "Foo"

View File

@ -1,5 +1,6 @@
" Ex commands
" START NOT MATCHED
:@
:@@

View File

@ -1,5 +1,6 @@
" Vim :debuggreedy command
debuggreedy
0debuggreedy

View File

@ -1,7 +1,7 @@
" Vim :def command
" list
" List
def
def Foo
@ -13,7 +13,7 @@ def Foo | echo "Foo"
def Foo " comment
" definition
" Definition
" empty definition
def Foo()
@ -60,7 +60,7 @@ def s:ls()
enddef
" return types
" Return types
def Foo(): void
enddef
@ -88,7 +88,7 @@ def Foo()
enddef # comment
" parameters
" Parameters
def Foo(x: bool, y = 42, z: string = "zed")
enddef
@ -105,7 +105,7 @@ def Test(lines: list<number> = [line('.'), line('.')]): void
enddef
" comments
" Comments
def Foo()
# Vim9-script comment
@ -113,13 +113,13 @@ def Foo()
enddef
" leading command separator
" Leading command separator
echo "Foo" | def Foo()
enddef
" command modifiers
" Command modifiers
silent! def Foo()
enddef

View File

@ -3,7 +3,7 @@
" VIM_TEST_SETUP setl fdc=2 fdl=999 fdm=syntax
" list
" List
def
def Foo
@ -15,7 +15,7 @@ def Foo | echo "Foo"
def Foo " comment
" definition
" Definition
" empty definition
def Foo()
@ -62,7 +62,7 @@ def s:ls()
enddef
" return types
" Return types
def Foo(): void
enddef
@ -90,7 +90,7 @@ def Foo()
enddef # comment
" parameters
" Parameters
def Foo(x: bool, y = 42, z: string = "zed")
enddef
@ -102,7 +102,7 @@ def Foo(
enddef
" comments
" Comments
def Foo()
# Vim9-script comment
@ -110,19 +110,19 @@ def Foo()
enddef
" command modifiers
" Command modifiers
silent! def Foo()
enddef
" leading command separator
" Leading command separator
echo "Foo" | def Foo()
enddef
" fold-region ending
" Fold-region ending
def Foo()
# enddef

View File

@ -2,6 +2,7 @@ vim9script
# Vim9 :def command (nested)
# VIM_TEST_SETUP hi link vim9This Todo
class Test
const name: string
@ -19,3 +20,4 @@ class Test
endclass
echo Test.new()

View File

@ -1,10 +1,10 @@
vim9script
# Vim9 :def command (nested)
# VIM_TEST_SETUP let g:vimsyn_folding = 'f'
# VIM_TEST_SETUP setl fdc=2 fdm=syntax
# VIM_TEST_SETUP hi link vim9This Todo
class Test
const name: string
@ -22,3 +22,4 @@ class Test
endclass
echo Test.new()

View File

@ -9,7 +9,7 @@ echoerr "Answer = " 42
echoconsole "Answer = " 42
" trailing bar vs OR operator
" Trailing bar vs OR operator
" OR operator
echo foo || bar
@ -25,7 +25,7 @@ echo "Foo" ||
echohl WarningMsg | echo "Don't panic!" | echohl None
" line continuations
" Line continuations
echo "Answer = "
"\ comment
@ -37,7 +37,7 @@ echo
\ 42
" trailing bar and comments
" Trailing bar and comments
" :echo without {expr}
echo| echo "Foo"

View File

@ -17,7 +17,7 @@ endif
execute 'while i < 5 | echo i | let i = i + 1 | endwhile'
" trailing bar vs OR operator
" Trailing bar vs OR operator
" OR operator
execute foo || bar ? "Foo" : "NotFoo"
@ -31,7 +31,7 @@ execute "Foo" | |
execute "Foo" ||
" line continuations
" Line continuations
execute "call"
"\ comment
@ -43,7 +43,7 @@ execute
\ "Foo()"
" trailing bar and comments
" Trailing bar and comments
" :execute without {expr}
execute| echo "Foo"

View File

@ -1,5 +1,5 @@
" Vim :filter command
" VIM_TEST_SETUP highlight link vimCmdSep Operator
" VIM_TEST_SETUP hi link vimCmdSep Operator
filter pa\%(tt\)ern oldfiles

View File

@ -1,7 +1,7 @@
" Vim :function command
" list
" List
function
function Foo
@ -13,7 +13,7 @@ function Foo | echo "Foo"
function Foo " comment
" definition
" Definition
" empty definition
function Foo()
@ -111,7 +111,7 @@ function s:ls()
endfunction
" modifiers
" Modifiers
function Foo() range
endfunction
@ -176,7 +176,7 @@ function Foo()
endfunction " comment
" parameters
" Parameters
function Foo(x, y, z, ...)
return 42
@ -217,7 +217,7 @@ function Foo(
endfunction
" arguments
" Arguments
function Foo(a, b, c)
echo a:a a:b a:c
@ -236,7 +236,7 @@ function Test(lines = [line('.'), line('.')])
endfunction
" comments
" Comments
function Foo()
" Legacy-script comment
@ -245,13 +245,13 @@ function Foo()
endfunction
" command modifiers
" Command modifiers
silent! function Foo()
endfunction
" leading command separator
" Leading command separator
echo "Foo" | function Foo()
endfunction

View File

@ -1,6 +1,7 @@
" Vim :function and :def tail comment errors
" VIM_TEST_SETUP unlet! g:vimsyn_folding
fun s:Test1() abort # fun
return 1
endfun # endfun
@ -41,3 +42,4 @@ for d in range(1, 6)->reverse()
exec $'echo s:Test{d}()'
exec $'delfunction s:Test{d}'
endfor

View File

@ -1,6 +1,7 @@
" Vim :function and :def tail comments
" VIM_TEST_SETUP unlet! g:vimsyn_folding
fun s:Test1() abort " fun
return 1
endfun " endfun
@ -41,3 +42,4 @@ for d in range(1, 6)->reverse()
exec $'echo s:Test{d}()'
exec $'delfunction s:Test{d}'
endfor

View File

@ -3,7 +3,7 @@
" VIM_TEST_SETUP setl fdc=2 fdl=999 fdm=syntax
" list
" List
function
function Foo
@ -15,7 +15,7 @@ function Foo | echo "Foo"
function Foo " comment
" definition
" Definition
" empty definition
function Foo()
@ -113,7 +113,7 @@ function s:ls()
endfunction
" modifiers
" Modifiers
function Foo() range
endfunction
@ -178,7 +178,7 @@ function Foo()
endfunction " comment
" parameters
" Parameters
function Foo(x, y, z, ...)
return 42
@ -219,7 +219,7 @@ function Foo(
endfunction
" arguments
" Arguments
function Foo(a, b, c)
echo a:a a:b a:c
@ -238,7 +238,7 @@ function Test(lines = [line('.'), line('.')])
endfunction
" comments
" Comments
function Foo()
" Legacy-script comment
@ -247,13 +247,13 @@ function Foo()
endfunction
" command modifiers
" Command modifiers
silent! function Foo()
endfunction
" leading command separator
" Leading command separator
echo "Foo" | function Foo()
endfunction
@ -267,7 +267,7 @@ func! s:func(_, func)
endfunc
" fold-region ending
" Fold-region ending
function Foo()
" endfunction

View File

@ -1,5 +1,6 @@
" Vim :def and :function commands (nested)
def FunA(): string
def DoFunA(): string
return "."
@ -36,3 +37,4 @@ echo FunA()
echo FunB()
echo FunC()
echo FunD()

View File

@ -2,6 +2,7 @@
" VIM_TEST_SETUP let g:vimsyn_folding = 'f'
" VIM_TEST_SETUP setl fdc=2 fdm=syntax
def FunA(): string
def DoFunA(): string
return "."
@ -38,3 +39,4 @@ echo FunA()
echo FunB()
echo FunC()
echo FunD()

View File

@ -16,7 +16,7 @@ grepadd! 'pat\|tern' foo.txt
lgrepadd! 'pat\|tern' foo.txt
" special filename characters
" Special filename characters
grep 'pat\|tern' %
lgrep 'pat\|tern' %
@ -31,7 +31,7 @@ grepadd! 'pat\|tern' %
lgrepadd! 'pat\|tern' %
" trailing bar, no tail comment
" Trailing bar, no tail comment
grep 'pat\|tern' foo.txt | echo "Foo"
lgrep 'pat\|tern' foo.txt | echo "Foo"

View File

@ -2,7 +2,7 @@
" VIM_TEST_SETUP hi link vimHiGroup Todo
" list
" List
highlight
highlight Comment
@ -11,12 +11,12 @@ highlight ErrorMsg
highlight Foo
" reset
" Reset
highlight clear
" disable
" Disable
highlight clear Comment
highlight clear Conceal
@ -29,7 +29,7 @@ highlight ErrorMsg NONE
highlight Foo NONE
" add/modify
" Add/modify
highlight Comment cterm=underline
highlight Conceal cterm=underline
@ -42,7 +42,7 @@ highlight default ErrorMsg term=bold
highlight Foo ErrorMsg term=bold
" link
" Link
highlight link Foo Comment
highlight! link Foo Comment
@ -52,7 +52,7 @@ highlight link Foo ErrorMsg
highlight! link Foo ErrorMsg
" default link
" Default link
highlight default link Foo Comment
highlight! default link Foo Comment
@ -62,7 +62,7 @@ highlight default link Foo ErrorMsg
highlight! default link Foo ErrorMsg
" line continuation and command separator
" Line continuation and command separator
hi Comment
"\ comment

View File

@ -68,7 +68,7 @@ line2
EOS
" trim
" Trim
let foo =<< trim END
line1
@ -81,7 +81,7 @@ END
END
" interpolation
" Interpolation
let foo =<< eval END
line{1 + 0}
@ -103,7 +103,7 @@ END
line{1 + 1}
END
" no interpolation (escaped { and })
" No interpolation (escaped { and })
let foo =<< eval END
line{{1 + 0}}
@ -126,7 +126,7 @@ END
END
" no interpolation
" No interpolation
let foo =<< END
line{1 + 0}
@ -149,7 +149,7 @@ END
END
" end marker must not be followed by whitespace
" End marker must not be followed by whitespace
" assert_equal(foo, ["END "])
let foo =<< END
@ -225,7 +225,7 @@ END
END
" end markers
" End markers
let foo =<< !@#$%^&*()_+
line1

View File

@ -1,5 +1,6 @@
" Vim :loadkeymap command
scriptencoding utf-8
let b:keymap_name = "syntax-test"
@ -22,3 +23,4 @@ c <char-0103> Special notation allowed in RHS - octal
# <char-0x00a3> Line should not match as a Vim9-script comment
\" “ Line should not match as a legacy-script comment
: " Line should not match as a legacy-script comment

View File

@ -1,5 +1,6 @@
" Vim :loadkeymap command (after "|")
scriptencoding utf-8
let b:keymap_name = "syntax-test"

View File

@ -1,5 +1,6 @@
" Vim :loadkeymap command (after ":")
scriptencoding utf-8
let b:keymap_name = "syntax-test"

View File

@ -1,6 +1,6 @@
" Vim :*make commands
" VIM_TEST_SETUP highlight link vimCmdSep Operator
" VIM_TEST_SETUP highlight link vimMakeBarEscape Special
" VIM_TEST_SETUP hi link vimCmdSep Operator
" VIM_TEST_SETUP hi link vimMakeBarEscape Special
make
@ -16,13 +16,13 @@ make! -options target
lmake! -options target
" special filename characters
" Special filename characters
make %
lmake %
" trailing bar, no tail comment
" Trailing bar, no tail comment
make tar\|get | echo "Foo"
lmake tar\|get | echo "Foo"

View File

@ -1,5 +1,6 @@
" Vim :map commands
map!
map! lhs rhs
map
@ -44,7 +45,7 @@ map _l :!ls | more^M:echo "rhs"<CR>
map lhs :search('foo\\|bar')<CR>:echo "rhs"<CR>
" multiline RHS
" Multiline RHS
map <Leader>baz
\ :echo (<Bar>
@ -117,3 +118,4 @@ nnoremap <Leader>bar :echo (
" /autoload/netrw.vim
if !hasmapto('<Plug>NetrwOpenFile') |nmap <buffer> <silent> <nowait> % <Plug>NetrwOpenFile|endif

View File

@ -1,5 +1,6 @@
" Vim :menu commands
" :help disable menus
menu disable &File.&Open\.\.\.
amenu enable *

View File

@ -1,5 +1,6 @@
" Vim :menutranslate command
menutranslate clear
menutranslate clear | echo "Foo"
menutranslate clear " comment

View File

@ -1,20 +1,30 @@
" Vim :normal command
normal j
normal! j
normal!j
" no trailing bar
" No trailing bar
normal j 42|echo "not echo command"
" no trailing comment
" No trailing comment
normal j "0p
" multiline arg
" Multiline arg
normal j
\k
"\ comment
\j
" word-boundary required after name (old bug)
" Issue: word-boundary required after name (old bug)
normalj

View File

@ -15,7 +15,7 @@ profdel file MyScript.vim
profdel here
" tail comment
" Tail comment
profile start /tmp/myprofile " comment
profile stop " comment
@ -31,7 +31,7 @@ profdel file MyScript.vim " comment
profdel here " comment
" trailing command
" Trailing command
profile start /tmp/myprofile | echo "Foo"
profile stop | echo "Foo"

View File

@ -1,5 +1,6 @@
" Vim :sleep command
sleep " sleep for one second
5 sleep " sleep for five seconds
sleep 100m " sleep for 100 milliseconds
@ -9,3 +10,4 @@ sleep! " sleep for one second
5 sleep! " sleep for five seconds
sleep! 100m " sleep for 100 milliseconds
100 sleep! m " sleep for 100 milliseconds

View File

@ -1,5 +1,7 @@
" Vim :throw command
" :help :throw
try | throw "oops" | catch /^oo/ | echo "caught" | endtry

View File

@ -1,7 +1,7 @@
" Vim :*vimgrep and :*vimgrepadd commands
" VIM_TEST_SETUP highlight link vimVimgrepFile Todo
" VIM_TEST_SETUP highlight link vimCmdSep Operator
" VIM_TEST_SETUP highlight link vimVimgrepBarEscape Special
" VIM_TEST_SETUP hi link vimVimgrepFile Todo
" VIM_TEST_SETUP hi link vimCmdSep Operator
" VIM_TEST_SETUP hi link vimVimgrepBarEscape Special
vimgrep pa\%(tt\)ern foo.txt

View File

@ -1,3 +1,6 @@
" Vim expressions
" String
echo 'It''s a string'

View File

@ -1,11 +1,11 @@
" Vim function calls
" VIM_TEST_SETUP highlight link vimUserFunc Todo
" VIM_TEST_SETUP hi link vimUserFunc Todo
call abs(42)
" command/function distinction
" Command/function distinction
" append browse call chdir confirm copy delete eval execute filter function
" insert join map match mode sort split substitute swapname type
@ -143,7 +143,7 @@ uniq(42)
uniq (42)
" errors
" Errors
let foo = foo(42)
call foo(42)
@ -161,7 +161,7 @@ echo(42)
echo (42)
" expressions
" Expressions
let foo = abs(42)
@ -176,7 +176,7 @@ echo Foo() + bar
echo bar + Foo()
" scope modifiers and qualified names
" Scope modifiers and qualified names
let foo = s:foo(42)
call s:foo(42)
@ -238,7 +238,7 @@ let foo = g:module#foo(42)
call g:module#foo(42)
" not builtin functions
" Not builtin functions
call s:substitute()
call g:substitute()
@ -264,7 +264,7 @@ call substitute#substitute()
call g:substitute#substitute()
" chained function calls
" Chained function calls
call module.foo().bar()
call module.foo().substitute()

View File

@ -1,5 +1,6 @@
" Vim function variable highlighting
function Foo()
" :let

View File

@ -1,5 +1,6 @@
" Key notation
map foo
\ <Space>
\ <Tab>

View File

@ -1,7 +1,7 @@
" Vim lambda expressions
" VIM_TEST_SETUP hi link vimLambdaOperator Todo
" VIM_TEST_SETUP hi link vimLambdaBrace Todo
" VIM_TEST_SETUP hi link vimFuncParam Identifier
" VIM_TEST_SETUP hi link vimLambdaBrace Todo
" VIM_TEST_SETUP hi link vimFuncParam Identifier
let expr = 42
@ -15,7 +15,7 @@ let Foo = {x, ... -> expr}
let Foo = {x, y -> expr}
" line continuations
" Line continuations
let Foo = {->
"\ comment

View File

@ -1,5 +1,6 @@
" Vim line continuations with interspersed comments
function Foo(
"\ param a
\ a,
@ -47,3 +48,4 @@ let array = [
"\ element 3
\ 3
\]

View File

@ -1,13 +1,16 @@
vim9script
# Vim :new command and class constructors
# TODO: move to vim9_constructor and create new vim_ex_new and vim9_ex_new
# tests
# Vim :new command and class constructors.
class Test
def new()
enddef
def newOther()
enddef
def newyetanother()
enddef
def new()
enddef
def newOther()
enddef
def newyetanother()
enddef
endclass
Test.new()
@ -15,3 +18,4 @@ Test.newOther()
Test.newyetanother()
new
quit

View File

@ -1,6 +1,7 @@
" Vim comment strings
" VIM_TEST_SETUP let g:vimsyn_comment_strings = v:false
" pre "string" post
function Foo()
@ -18,3 +19,4 @@ command Foo {
autocmd BufNewFile * {
# pre "string" post
}

View File

@ -1,6 +1,7 @@
" Neovim variable highlighting
" VIM_TEST_SETUP let g:vimsyn_vim_features = ["nvim"]
echo v:lua v:msgpack_types v:relnum v:stderr v:termrequest v:virtnum
echo &channel &inccommand &mousescroll &pumblend &redrawdebug &scrollback

View File

@ -1,5 +1,5 @@
#!/usr/bin/env vim -S
" Vim shebang line
#!/usr/bin/env vim -S

View File

@ -1,5 +1,6 @@
" Vim variable highlighting
" :let
let foo = expr