Mercurial > vim
comparison runtime/doc/eval.txt @ 22232:f22acf6472da v8.2.1665
patch 8.2.1665: cannot do fuzzy string matching
Commit: https://github.com/vim/vim/commit/635414dd2f3ae7d4d972d79b806348a6516cb91a
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Sep 11 22:25:15 2020 +0200
patch 8.2.1665: cannot do fuzzy string matching
Problem: Cannot do fuzzy string matching.
Solution: Add matchfuzzy(). (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6932)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 11 Sep 2020 22:30:04 +0200 |
parents | d4c7b3e9cd17 |
children | 07e48ee8c3bb |
comparison
equal
deleted
inserted
replaced
22231:e1311fb42cd4 | 22232:f22acf6472da |
---|---|
2639 Number highlight positions with {group} | 2639 Number highlight positions with {group} |
2640 matcharg({nr}) List arguments of |:match| | 2640 matcharg({nr}) List arguments of |:match| |
2641 matchdelete({id} [, {win}]) Number delete match identified by {id} | 2641 matchdelete({id} [, {win}]) Number delete match identified by {id} |
2642 matchend({expr}, {pat} [, {start} [, {count}]]) | 2642 matchend({expr}, {pat} [, {start} [, {count}]]) |
2643 Number position where {pat} ends in {expr} | 2643 Number position where {pat} ends in {expr} |
2644 matchfuzzy({list}, {str}) List fuzzy match {str} in {list} | |
2644 matchlist({expr}, {pat} [, {start} [, {count}]]) | 2645 matchlist({expr}, {pat} [, {start} [, {count}]]) |
2645 List match and submatches of {pat} in {expr} | 2646 List match and submatches of {pat} in {expr} |
2646 matchstr({expr}, {pat} [, {start} [, {count}]]) | 2647 matchstr({expr}, {pat} [, {start} [, {count}]]) |
2647 String {count}'th match of {pat} in {expr} | 2648 String {count}'th match of {pat} in {expr} |
2648 matchstrpos({expr}, {pat} [, {start} [, {count}]]) | 2649 matchstrpos({expr}, {pat} [, {start} [, {count}]]) |
7305 When {expr} is a |List| the result is equal to |match()|. | 7306 When {expr} is a |List| the result is equal to |match()|. |
7306 | 7307 |
7307 Can also be used as a |method|: > | 7308 Can also be used as a |method|: > |
7308 GetText()->matchend('word') | 7309 GetText()->matchend('word') |
7309 | 7310 |
7311 | |
7312 matchfuzzy({list}, {str}) *matchfuzzy()* | |
7313 Returns a list with all the strings in {list} that fuzzy | |
7314 match {str}. The strings in the returned list are sorted | |
7315 based on the matching score. {str} is treated as a literal | |
7316 string and regular expression matching is NOT supported. | |
7317 The maximum supported {str} length is 256. | |
7318 | |
7319 If there are no matching strings or there is an error, then an | |
7320 empty list is returned. If length of {str} is greater than | |
7321 256, then returns an empty list. | |
7322 | |
7323 Example: > | |
7324 :echo matchfuzzy(["clay", "crow"], "cay") | |
7325 < results in ["clay"]. > | |
7326 :echo getbufinfo()->map({_, v -> v.name})->matchfuzzy("ndl") | |
7327 < results in a list of buffer names fuzzy matching "ndl". > | |
7328 :echo v:oldfiles->matchfuzzy("test") | |
7329 < results in a list of file names fuzzy matching "test". > | |
7330 :let l = readfile("buffer.c")->matchfuzzy("str") | |
7331 < results in a list of lines in "buffer.c" fuzzy matching "str". | |
7332 | |
7333 | |
7310 matchlist({expr}, {pat} [, {start} [, {count}]]) *matchlist()* | 7334 matchlist({expr}, {pat} [, {start} [, {count}]]) *matchlist()* |
7311 Same as |match()|, but return a |List|. The first item in the | 7335 Same as |match()|, but return a |List|. The first item in the |
7312 list is the matched string, same as what matchstr() would | 7336 list is the matched string, same as what matchstr() would |
7313 return. Following items are submatches, like "\1", "\2", etc. | 7337 return. Following items are submatches, like "\1", "\2", etc. |
7314 in |:substitute|. When an optional submatch didn't match an | 7338 in |:substitute|. When an optional submatch didn't match an |