aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/builtin.txt5
-rw-r--r--runtime/doc/pattern.txt33
-rw-r--r--runtime/doc/quickfix.txt7
3 files changed, 44 insertions, 1 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 45c03fc447..b7a9a06b3c 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -4862,7 +4862,7 @@ matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()*
GetText()->matchend('word')
matchfuzzy({list}, {str} [, {dict}]) *matchfuzzy()*
- If {list} is a list of strings, then returns a list with all
+ 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.
@@ -4895,6 +4895,9 @@ matchfuzzy({list}, {str} [, {dict}]) *matchfuzzy()*
empty list is returned. If length of {str} is greater than
256, then returns an empty list.
+ Refer to |fuzzy-match| for more information about fuzzy
+ matching strings.
+
Example: >
:echo matchfuzzy(["clay", "crow"], "cay")
< results in ["clay"]. >
diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt
index 634145da3e..42005b0d78 100644
--- a/runtime/doc/pattern.txt
+++ b/runtime/doc/pattern.txt
@@ -1421,5 +1421,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 at a camel case character (e.g. Case in CamelCase)
+ - Matches after 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:
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt
index c7289cfca6..ed736ad4eb 100644
--- a/runtime/doc/quickfix.txt
+++ b/runtime/doc/quickfix.txt
@@ -1014,6 +1014,13 @@ commands can be combined to create a NewGrep command: >
updated. With the [!] any changes in the current
buffer are abandoned.
+ 'f' When the 'f' flag is specified, fuzzy string
+ matching is used to find matching lines. In this
+ case, {pattern} is treated as a literal string
+ instead of a regular expression. See
+ |fuzzy-match| for more information about fuzzy
+ matching strings.
+
|QuickFixCmdPre| and |QuickFixCmdPost| are triggered.
A file that is opened for matching may use a buffer
number, but it is reused if possible to avoid