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", {'key' : 'name'})
< results in a list of buffer information dicts with buffer
names fuzzy matching "ndl". >vim
echo getbufinfo()->matchfuzzy("spl",
\ {'text_cb' : {v -> v.name}})
< results in a list of buffer information dicts with buffer
names fuzzy matching "spl". >vim
echo v:oldfiles->matchfuzzy("test")
< results in a list of file names fuzzy matching "test". >vim
let l = readfile("buffer.c")->matchfuzzy("str")
< results in a list of lines in "buffer.c" fuzzy matching "str". >vim
echo ['one two', 'two one']->matchfuzzy('two one')
< results in `['two one', 'one two']` . >vim
echo ['one two', 'two one']->matchfuzzy('two one',
\ {'matchseq': 1})
< results in `['two one']`.
Parameters: ~
• {list} (`any[]`)
• {str} (`string`)
• {dict} (`table?`)
Return: ~
(`any`)
matchfuzzypos({list}, {str} [, {dict}]) *matchfuzzypos()*
Same as |matchfuzzy()|, but returns the list of matched
strings, the list of character positions where characters
in {str} matches and a list of matching scores. You can
use |byteidx()| to convert a character position to a byte
position.
If {str} matches multiple times in a string, then only the
positions for the best match is returned.
If there are no matching strings or there is an error, then a
list with three empty list items is returned.
Example: >vim
echo matchfuzzypos(['testing'], 'tsg')
< results in [["testing"], [[0, 2, 6]], [99]] >vim
echo matchfuzzypos(['clay', 'lacy'], 'la')
< results in [["lacy", "clay"], [[0, 1], [1, 2]], [153, 133]] >vim
echo [{'text': 'hello', 'id' : 10}]
\ ->matchfuzzypos('ll', {'key' : 'text'})
< results in `[[{"id": 10, "text": "hello"}], [[2, 3]], [127]]`
Parameters: ~
• {list} (`any[]`)
• {str} (`string`)
• {dict} (`table?`)
Return: ~
(`any`)
matchlist({expr}, {pat} [, {start} [, {count}]]) *matchlist()*
Same as |match()|, but return a |List|. The first item in the
list is the matched string, same as what matchstr() would
return. Following items are submatches, like "\1", "\2", etc.
in |:substitute|. When an optional submatch didn't match an
empty string is used. Example: >vim
echo matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)')
< Results in: ['acd', 'a', '', 'c', 'd', '', '', '', '', '']
When there is no match an empty list is returned.
You can pass in a List, but that is not very useful.
Parameters: ~
• {expr} (`any`)
• {pat} (`string`)
• {start} (`integer?`)
• {count} (`integer?`)
Return: ~
(`any`)
matchstr({expr}, {pat} [, {start} [, {count}]]) *matchstr()*
Same as |match()|, but return