not found, then an empty string is returned for that
submatch.
Parameters: ~
• {buf} (`string|integer`)
• {pat} (`string`)
• {lnum} (`string|integer`)
• {end} (`string|integer`)
• {dict} (`table?`)
Return: ~
(`any`)
matchdelete({id} [, {win}]) *matchdelete()* *E802* *E803*
Deletes a match with ID {id} previously defined by |matchadd()|
or one of the |:match| commands. Returns 0 if successful,
otherwise -1. See example for |matchadd()|. All matches can
be deleted in one operation by |clearmatches()|.
If {win} is specified, use the window with this number or
window ID instead of the current window.
Parameters: ~
• {id} (`integer`)
• {win} (`integer?`)
Return: ~
(`any`)
matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()*
Same as |match()|, but return the index of first character
after the match. Example: >vim
echo matchend("testing", "ing")
< results in "7".
*strspn()* *strcspn()*
Vim doesn't have a strspn() or strcspn() function, but you can
do it with matchend(): >vim
let span = matchend(line, '[a-zA-Z]')
let span = matchend(line, '[^a-zA-Z]')
< Except that -1 is returned when there are no matches.
The {start}, if given, has the same meaning as for |match()|. >vim
echo matchend("testing", "ing", 2)
< results in "7". >vim
echo matchend("testing", "ing", 5)
< result is "-1".
When {expr} is a |List| the result is equal to |match()|.
Parameters: ~
• {expr} (`any`)
• {pat} (`string`)
• {start} (`integer?`)
• {count} (`integer?`)
Return: ~
(`any`)
matchfuzzy({list}, {str} [, {dict}]) *matchfuzzy()*
If {list} is a list of strings, then returns a |List| with all
the strings in {list} that fuzzy match {str}. The strings in
the returned list are sorted based on the matching score.
The optional {dict} argument always supports the following
items:
matchseq When this item is present return only matches
that contain the characters in {str} in the
given sequence.
limit Maximum number of matches in {list} to be
returned. Zero means no limit.
camelcase Use enhanced camel case scoring making results
better suited for completion related to
programming languages. Defaults to v:true.
If {list} is a list of dictionaries, then the optional {dict}
argument supports the following additional items:
key Key of the item which is fuzzy matched against
{str}. The value of this item should be a
string.
text_cb |Funcref| that will be called for every item
in {list} to get the text for fuzzy matching.
This should accept a dictionary item as the
argument and return the text for that item to
use for fuzzy matching.
{str} is treated as a literal string and regular expression
matching is NOT supported. The maximum supported {str} length
is 256.
When {str} has multiple words each separated by white space,
then the list of strings that have all the words is returned.
If there are no matching strings or there is an error, then an
empty list is returned. If length of {str} is greater than
256, then returns an empty list.
When {limit} is given, matchfuzzy() will find up to this
number of matches in {list} and return them in sorted order.
Refer to |fuzzy-matching| for more information about fuzzy
matching strings.
Example: >vim
echo matchfuzzy(["clay", "crow"], "cay")
< results in ["clay"]. >vim
echo getbufinfo()->map({_, v -> v.name})->matchfuzzy("ndl")
< results in a list of buffer names fuzzy matching "ndl". >vim
echo getbufinfo()->matchfuzzy("ndl",