Christian wrote:
> On Do, 15 Okt 2020, Yegappan Lakshmanan wrote:
>
> > On Thu, Oct 15, 2020 at 12:24 PM Bram Moolenaar <
Br...@moolenaar.net> wrote:
> >
> >
> > Christian wrote:
> >
> > > Indeed. Initially I thought adding a bonus for a word boundary would be
> > > needed, therefore my naive attempt to score additionally on the end of
> > > the match. So how about this, which adds an additional bonus only for a
> > > complete match.
> > >
> >
> > An extra score for a whole match makes a big jump. It might work better
> > when giving a match a bit of extra score if the previous character also
> > matched. Thus the more consequtive characters match the better. This
> > seems to make sense: matches spread out over a line of text score lower
> > than when some matches group together. And reach the maximum when they
> > are all together.
> >
> >
> >
> > The current implementation already supports this. Each sequential matching
> > character is given a bonus score (SEQUENTIAL_BONUS).
> >
> > A matching character after an underscore or space is given a bonus
> > score (SEPARATOR_BONUS). Because of this a string with a matching
> > letter after an underscore is given precedence over a fully matched sequence
> > of characters.
>
> Yes currently, SEQUENTIAL_BONUS is 15, while SEPARATOR_BONUS is 30.
> This makes `v_i_m_r_c` be the preferred match against e.g. vimrc.
>
> So I think SEQUENTIAL_BONUS should probably score higher than
> SEPARATOR_BONUS. I think this might be a better way to continue here.
Aha. So it might just be a matter of adjusting the weights.
> I'll make a PR for that.
>
> On a related note, I wonder whether SEPARATOR_BONUS should also be added
> for path delimiters (`/` on unix `\` on windows).
I wonder why that "after underscore" bonus was added. Isn't this
similar to a "start of word" bonus, like after a space or at the start
of the text? I haven't looked into the whole algorithm, but to me it
seems that this bonus should only be given when the start of a word in
the search string matches the start of a word in the text. E.g, when
searching for "hello world" then a match in "hello worldwize" would
match a bit better than "hello xxxworldwize".
I wonder why underscore was made so important. When matching in
keywords in programming name_with_underscores still has "name" at the
start as a more imporant boundary than the underscores. Or a slash, dot
and other separator characters.
--
Where do you want to crash today?