summaryrefslogtreecommitdiff
path: root/src/search.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-10-20 19:01:30 +0200
committerBram Moolenaar <Bram@vim.org>2020-10-20 19:01:30 +0200
commite9f9f16387554e5b34ba42ce00c42c28dd66af58 (patch)
treeae00de3d74be30a34cd5b4e7a704481789719a3d /src/search.c
parentc95940c06a125d3afe6516f11f8b2f5697a6b3b9 (diff)
downloadvim-git-e9f9f16387554e5b34ba42ce00c42c28dd66af58.tar.gz
patch 8.2.1872: matchfuzzy() does not prefer sequential matchesv8.2.1872
Problem: Matchfuzzy() does not prefer sequential matches. Solution: Give sequential matches a higher bonus. (Christian Brabandt, closes #7140)
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/search.c b/src/search.c
index 349eae035..8133df4b0 100644
--- a/src/search.c
+++ b/src/search.c
@@ -4252,8 +4252,9 @@ typedef struct
list_T *lmatchpos;
} fuzzyItem_T;
-// bonus for adjacent matches
-#define SEQUENTIAL_BONUS 15
+// bonus for adjacent matches; this is higher than SEPARATOR_BONUS so that
+// matching a whole word is preferred.
+#define SEQUENTIAL_BONUS 40
// bonus if match occurs after a separator
#define SEPARATOR_BONUS 30
// bonus if match is uppercase and prev is lower