| ... | ... |
@@ -48,10 +48,10 @@ nnoremap <leader>s :call FzyCommand("ag . --no-color -l -g ''", ":sp")<cr>
|
| 48 | 48 |
|
| 49 | 49 |
fzy attempts to present the best matches first. The following considerations are weighted when sorting: |
| 50 | 50 |
|
| 51 |
-It prefers matching the beginning of words: `amo` is likely to match <tt><b>a</b>pp/<b>m</b>odels/<b>o</b>rder.rb</tt>. |
|
| 52 |
- |
|
| 53 | 51 |
It prefers consecutive characters: `file` will match <tt><b>file</b></tt> over <tt><b>fil</b>t<b>e</b>r</tt>. |
| 54 | 52 |
|
| 53 |
+It prefers matching the beginning of words: `amp` is likely to match <tt><b>a</b>pp/<b>m</b>odels/<b>p</b>osts.rb</tt>. |
|
| 54 |
+ |
|
| 55 | 55 |
It prefers shorter matches: `abce` matches <tt><b>abc</b>d<b>e</b>f</tt> over <tt><b>abc</b> d<b>e</b></tt>. |
| 56 | 56 |
|
| 57 | 57 |
It prefers shorter candidates: `test` matches <tt><b>test</b>s</tt> over <tt><b>test</b>ing</b></tt>. |
| ... | ... |
@@ -29,8 +29,8 @@ int test_match(){
|
| 29 | 29 |
} |
| 30 | 30 |
|
| 31 | 31 |
int test_scoring(){
|
| 32 |
- /* App/Models/Order is better than App/MOdels/foo */ |
|
| 33 |
- assert(match("amo", "app/models/foo") < match("amo", "app/models/order"));
|
|
| 32 |
+ /* App/Models/Order is better than App/MOdels/zRder */ |
|
| 33 |
+ assert(match("amor", "app/models/order") > match("amor", "app/models/zrder"));
|
|
| 34 | 34 |
|
| 35 | 35 |
/* App/MOdels/foo is better than App/M/fOo */ |
| 36 | 36 |
assert(match("amo", "app/m/foo") < match("amo", "app/models/foo"));
|
| ... | ... |
@@ -72,8 +72,8 @@ int test_positions_2(){
|
| 72 | 72 |
* We should prefer matching the 'o' in order, since it's the beginning |
| 73 | 73 |
* of a word. |
| 74 | 74 |
*/ |
| 75 |
- size_t positions[3]; |
|
| 76 |
- match_positions("amo", "app/models/order", positions);
|
|
| 75 |
+ size_t positions[4]; |
|
| 76 |
+ match_positions("amor", "app/models/order", positions);
|
|
| 77 | 77 |
assert(positions[0] == 0); |
| 78 | 78 |
assert(positions[1] == 4); |
| 79 | 79 |
assert(positions[2] == 11); |
| ... | ... |
@@ -77,10 +77,10 @@ double calculate_score(const char *needle, const char *haystack, size_t *positio |
| 77 | 77 |
#define SCORE_GAP_TRAILING -0.005 |
| 78 | 78 |
#define SCORE_GAP_INNER -0.01 |
| 79 | 79 |
#define SCORE_MATCH_CONSECUTIVE 1.0 |
| 80 |
-#define SCORE_MATCH_SLASH 1.5 |
|
| 81 |
-#define SCORE_MATCH_WORD 1.2 |
|
| 82 |
-#define SCORE_MATCH_CAPITAL 1.1 |
|
| 83 |
-#define SCORE_MATCH_DOT 0.8 |
|
| 80 |
+#define SCORE_MATCH_SLASH 0.9 |
|
| 81 |
+#define SCORE_MATCH_WORD 0.8 |
|
| 82 |
+#define SCORE_MATCH_CAPITAL 0.7 |
|
| 83 |
+#define SCORE_MATCH_DOT 0.6 |
|
| 84 | 84 |
|
| 85 | 85 |
/* Which positions are beginning of words */ |
| 86 | 86 |
char last_ch = '\0'; |