runtime(vim): Update base syntax, improve :match highlighting

- Match the range prefix separately as a count.
- Match an explicit count of 1, rarely used but seen in the wild.
- Allow whitespace between the count and command.

closes: #17717

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-13 09:05:23 +02:00
committed by Christian Brabandt
parent 2ab4f907a2
commit ce1d1969f3
145 changed files with 950 additions and 898 deletions

View File

@ -14,8 +14,6 @@ vim9script
: help
: help # FIXME
:2match
:3match
:abbreviate
:abclear
:aboveleft
@ -598,8 +596,6 @@ Foo() | help
Foo() |help
Foo()| help
Foo() | 2match
Foo() | 3match
Foo() | abbreviate
Foo() | abclear
Foo() | aboveleft

View File

@ -13,8 +13,6 @@
: help
: help # FIXME
:2match
:3match
:append
text
.
@ -598,8 +596,6 @@ call Foo() | help
call Foo() |help
call Foo()| help
call Foo() | 2match
call Foo() | 3match
" FIXME
call Foo() | append
text

View File

@ -5,6 +5,10 @@ match FooGroup /Foo/
match
match none
1match FooGroup /Foo/
1match
1match none
2match FooGroup /Foo/
2match
2match none
@ -13,12 +17,24 @@ match none
3match
3match none
1 match FooGroup /Foo/
2 match FooGroup /Foo/
3 match FooGroup /Foo/
" Differentiate match() from :match
call match(haystack, 'needle')
call match (haystack, 'needle')
let foo = match(haystack, 'needle')
echo match(haystack, 'needle')
echo (match(haystack, 'needle') + 42)
echo (42 + match(haystack, 'needle'))
" Containing functions
function Foo()
match FooGroup /Foo/
call match(haystack, 'needle')
@ -28,9 +44,21 @@ endfunction
def Foo()
# command
match FooGroup /Foo/
# function
match(haystack, 'needle')
# Error: bad :match command - trailing characters
match (haystack, 'needle')
# function
match(haystack, 'needle')
call match(haystack, 'needle')
enddef
" Trailing bar and comments
match FooGroup /Foo/ | echo "Foo"
match | echo "Foo"
match none | echo "Foo"
match FooGroup /Foo/ " comment
match " comment
match none " comment