mirror of
https://github.com/vim/vim.git
synced 2026-04-24 04:39:27 +02:00
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:
committed by
Christian Brabandt
parent
2ab4f907a2
commit
ce1d1969f3
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user