Fuzzy scoring of beginning of line vs length

14 views
Skip to first unread message

Maxim Kim

unread,
Nov 5, 2020, 3:13:19 PM11/5/20
to vim_dev
Hi, looks like text matched in the beginning has lower score than a shorter line with text not in the beginning:


min repro:

echo ['hello world with a longer line', 'onceHello']->matchfuzzy('hello')

result:

['onceHello', 'hello world with a longer line']

I personally would expect that 'hello world with a longer line' would be scored higher.

Yegappan Lakshmanan

unread,
Nov 5, 2020, 8:38:27 PM11/5/20
to vim_dev
Hi,

The match at the beginning of a string does get a bonus score (15).
But the score is reduced by each unmatched letter in the string.
In the case of the long string in the above example, the number
of unmatched letters (25) is greater than the bonus for the match
at the start of the string (15). So the score for "onceHello" is higher
than for the long string.

- Yegappan

Reply all
Reply to author
Forward
0 new messages