Hi,

On Thu, Apr 29, 2021 at 4:44 AM Dominique Pellé
<[email protected]> wrote:
>
> Yegappan Lakshmanan <[email protected]> wrote:
>
> > Hi all,
> >
> > The support for searching for fuzzy matches with the
> > vimgrep command was recently added (8.2.2813).
> >
> > In the current implementation, each line in a specified file(s)
> > is compared against the supplied search string (fuzzy match)
> > and if there is a match, then the line is added to the
> > quickfix list.
> >
> > The matches are not sorted by the fuzzy match score. So the
> > line that has the best match for the supplied string may be
> > present later in the quickfix list.
> >
> > Should we order the matches by the fuzzy match score so that
> > the best matches show up earlier in the quickfix list? One
> > downside to this approach is that the entries in the quickfix
> > list will not be sorted by the file name and the line number
> > and they will be mixed across files.
> >
> > - Yegappan
>
> It's not so clear to me in which cases I will use fuzzy :vimgrep.
> The results are often unclear as to why they match.
>

Fuzzy matching using vimgrep is useful, when you are searching
for multiple partial words which can occur in any order. But I agree
that it will be more useful to sort the matches by score so that
the best matches will be listed first.

>
> I did this for example in Vim:
>
>   :cd vim/src
>   :vimgrep /message/f *.c
>
> I get results like this:
>
> arglist.c|20 col 38| // This flag is set whenever the argument list is
> being changed and calling a
>
> At first I expected to find a word that looked like "message"
> but that's not the case. I think this line matches because it
> matches /m.*e.*s.*s.*a.*g.*e/
>

Yes. But note that the best match within a line is used and the
column is set to the first matching character.

>
> This kind of fuzzy matching makes more sense to me when:
> - it's sorted by score (as you suggest)
> - and there is some visual feedback (highlighting of what matches)
>   to help understand why it matches, as done e.g by
>     https://github.com/junegunn/fzf
>     https://github.com/junegunn/fzf.vim
>
> Regards
> Dominique
>

Thanks,
Yegappan

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAAW7x7%3DAkhBBT2cw7xA-zGauMLvY%3DGKNbkzLU5bF0scam02ZNg%40mail.gmail.com.

Raspunde prin e-mail lui