Skip to content

Fuzzy matching prioritizes internal match to prefix match #17531

@lifepillar

Description

@lifepillar

Steps to reproduce

Execute:

echo matchfuzzy(['BindTerminal', 'terminal'], 'term')

The output is ['BindTerminal', 'terminal']. Or, in the command line:

  1. vim --clean
  2. set wildoptions=fuzzy
  3. :command BindTerminal :<cr>
  4. :trm<TAB>

The command line is expanded to BindTerminal. This behaviour has started with patch v9.1.1046.

Expected behaviour

In the examples above, I would expect that terminal is the first match, as it matches a prefix of the text (case-sensitively, btw).

Even ignoring the position of the match, term or trm is intuitively “more similar” (e.g., in terms of edit distance) to terminal than to BindTerminal.

Version of Vim

9.1.1455

Environment

macOS
Apple Terminal
xterm-256color
ZSH 5.9

Logs and stack traces

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions