[vim/vim] [Doc] A strange criterion for fuzzy search scoring (#8577)

13 views
Skip to first unread message

naohiro ono

unread,
Jul 15, 2021, 10:50:33 PM7/15/21
to vim/vim, Subscribed

This is one of the criteria for fuzzy search scoring written in :h fuzzy-match:

    - Matches after a camel case character or a path separator or a hyphen.

I think it makes sense that matches after

  • a path separator or
  • a hyphen

will affect the score, but I wonder if it is true that matches AFTER

  • a camel case character

will also affect. (I'm assuming here that "a camel case character" stands for an uppercase letter in a lower-camel-cased word, e.g. "C" in "camalCase".)

So I think this may be some kind of mistake. Perhaps this patch may fix it:

diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt
index 962882765..8e2d8a45e 100644
--- a/runtime/doc/pattern.txt
+++ b/runtime/doc/pattern.txt
@@ -1472,7 +1472,8 @@ criteria:
     - The number of characters (distance) between two consecutive matching
       characters.
     - Matches at the beginning of a word
-    - Matches after a camel case character or a path separator or a hyphen.
+    - Matches at a camel case character.
+    - 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.
 


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

naohiro ono

unread,
Jul 15, 2021, 11:00:47 PM7/15/21
to vim/vim, Subscribed

cc @yegappan

Yegappan Lakshmanan

unread,
Jul 16, 2021, 10:52:16 AM7/16/21
to vim_dev, reply+ACY5DGCJBPYOKBKD2D...@reply.github.com, vim/vim, Subscribed
Hi,

On Thu, Jul 15, 2021 at 7:50 PM naohiro ono <vim-dev...@256bit.org> wrote:

This is one of the criteria for fuzzy search scoring written in :h fuzzy-match:

    - Matches after a camel case character or a path separator or a hyphen.

I think it makes sense that matches after

  • a path separator or
  • a hyphen

will affect the score, but I wonder if it is true that matches AFTER

  • a camel case character

will also affect. (I'm assuming here that "a camel case character" stands for an uppercase letter in a lower-camel-cased word, e.g. "C" in "camalCase".)

So I think this may be some kind of mistake. Perhaps this patch may fix it:

diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt
index 962882765..8e2d8a45e 100644
--- a/runtime/doc/pattern.txt
+++ b/runtime/doc/pattern.txt
@@ -1472,7 +1472,8 @@ criteria:
     - The number of characters (distance) between two consecutive matching
       characters.
     - Matches at the beginning of a word
-    - Matches after a camel case character or a path separator or a hyphen.
+    - Matches at a camel case character.
+    - 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.
 

Yes. The description looks good to me. The matches starting with a camel
case character are given an additional score.

Regards,
Yegappan 

vim-dev ML

unread,
Jul 16, 2021, 10:52:34 AM7/16/21
to vim/vim, vim-dev ML, Your activity

Hi,

On Thu, Jul 15, 2021 at 7:50 PM naohiro ono ***@***.***>
wrote:


> This is one of the criteria for fuzzy search scoring written in :h
> fuzzy-match:
>
> - Matches after a camel case character or a path separator or a hyphen.
>
> I think it makes sense that matches after
>
> - a path separator or
> - a hyphen

>
> will affect the score, but I wonder if it is true that matches AFTER
>
> - a camel case character

>
> will also affect. (I'm assuming here that "a camel case character" stands
> for an uppercase letter in a lower-camel-cased word, e.g. "C" in
> "camalCase".)
>
> So I think this may be some kind of mistake. Perhaps this patch may fix it:
>
> diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt
> index 962882765..8e2d8a45e 100644--- a/runtime/doc/pattern.txt+++ b/runtime/doc/pattern.txt@@ -1472,7 +1472,8 @@ criteria:

> - The number of characters (distance) between two consecutive matching
> characters.
> - Matches at the beginning of a word- - Matches after a camel case character or a path separator or a hyphen.+ - Matches at a camel case character.+ - 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.
>
>
>
Yes. The description looks good to me. The matches starting with a camel
case character are given an additional score.

Regards,
Yegappan

naohiro ono

unread,
Jul 16, 2021, 11:17:56 AM7/16/21
to vim/vim, vim-dev ML, Comment

@yegappan Thank you so much for the check. Then we can include this in the next update of runtime files. :)


You are receiving this because you commented.

Bram Moolenaar

unread,
Jul 16, 2021, 4:10:44 PM7/16/21
to vim/vim, vim-dev ML, Comment

Closed #8577.


You are receiving this because you commented.

Bram Moolenaar

unread,
Jul 16, 2021, 4:10:44 PM7/16/21
to vim/vim, vim-dev ML, Comment

It is more precise, I'll include that change.


You are receiving this because you commented.

Reply all
Reply to author
Forward
0 new messages