diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-05-16 12:39:47 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-05-16 12:39:47 +0200 |
commit | 3ec3217f0491e9ba8aa8ea02f7e454cd19a287ef (patch) | |
tree | 06fa2c8e003d252e1a537483aa6b93885e76bca9 /runtime/doc/pattern.txt | |
parent | 50157ef1c2e36d8696e79fd688bdd08312196bc6 (diff) |
Update runtime files
Diffstat (limited to 'runtime/doc/pattern.txt')
-rw-r--r-- | runtime/doc/pattern.txt | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index a5b9099e3e..20fed5523c 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1,4 +1,4 @@ -*pattern.txt* For Vim version 8.2. Last change: 2021 Feb 16 +*pattern.txt* For Vim version 8.2. Last change: 2021 May 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -19,6 +19,7 @@ explanations are in chapter 27 |usr_27.txt|. 8. Composing characters |patterns-composing| 9. Compare with Perl patterns |perl-patterns| 10. Highlighting matches |match-highlight| +11. Fuzzy matching |fuzzy-match| ============================================================================== 1. Search commands *search-commands* @@ -1431,5 +1432,38 @@ Finally, these constructs are unique to Perl: are suggested to use ":match" for manual matching and ":2match" for another plugin. +============================================================================== +11. Fuzzy matching *fuzzy-match* + +Fuzzy matching refers to matching strings using a non-exact search string. +Fuzzy matching will match a string, if all the characters in the search string +are present anywhere in the string in the same order. Case is ignored. In a +matched string, other characters can be present between two consecutive +characters in the search string. If the search string has multiple words, then +each word is matched separately. So the words in the search string can be +present in any order in a string. + +Fuzzy matching assigns a score for each matched string based on the following +criteria: + - The number of sequentially matching characters. + - The number of characters (distance) between two consecutive matching + characters. + - Matches at the beginning of a word + - Matches after a camel case character or a path separator or a hyphen. + - The number of unmatched characters in a string. +The matching string with the highest score is returned first. + +For example, when you search for the "get pat" string using fuzzy matching, it +will match the strings "GetPattern", "PatternGet", "getPattern", "patGetter", +"getSomePattern", "MatchpatternGet" etc. + +The functions |matchfuzzy()| and |matchfuzzypos()| can be used to fuzzy search +a string in a List of strings. The matchfuzzy() function returns a List of +matching strings. The matchfuzzypos() functions returns the List of matches, +the matching positions and the fuzzy match scores. + +The "f" flag of `:vimgrep` enables fuzzy matching. + + vim:tw=78:ts=8:noet:ft=help:norl: |