Enable fuzzy matching for ref completion#2474
Open
ro0gr wants to merge 2 commits into
Open
Conversation
Use matchfuzzy() for branch, tag, remote, push, and edit completion. For now, this uses Fugitive's existing shared ref completion source, so fuzzy matching applies across branches, remotes, tags like v1.2.3, and symbolic refs such as HEAD and FETCH_HEAD. If you find that too noisy, narrowing it later to branches and remotes may be breaking, so early feedback on that tradeoff is useful. For commit completion, fuzzy matching is enabled specifically for --fixup= and --squash= subject suggestions, where matching commit subjects is useful; other commit completion paths keep their existing behavior. Preserves case-sensitive prefix filtering for commands and file paths. Includes a compatibility guard for Vim versions lacking matchfuzzy(). Assisted-by: AI tools
Owner
|
@ro0gr Hi, did you request that Copilot review or was that something GitHub did automatically? I have been too busy to stay on top of incoming PRs lately, but I want to make sure some bot isn't wasting people's time. |
Author
|
@tpope I didn't enable it explicitly, but I still have a Copilot subscription. I just noticed that "Copilot Review" was enabled in my settings. Thanks for the heads up! |
In addition to matchfuzzy() availability, respect user preference via wildoptions. Works for both Vim (9.0+) and Neovim. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enable fuzzy matching for Fugitive ref completion using Vim's
matchfuzzy().This applies to branch, tag, remote, push, edit, and
--fixup=/--squash=commit-subject completion.Command and file path completion keep their existing prefix-matching behavior.
On older Vim versions that do not support
matchfuzzy(), completion falls back to the previous prefix-based matching.For now, this uses Fugitive's existing shared ref completion source, so fuzzy matching applies across branches, remotes, tags like
v1.2.3, and symbolic refs such asHEADandFETCH_HEAD. If you find that too noisy, narrowing it later to branches and remotes may be breaking, so early feedback on that tradeoff is useful.For commit completion, the change is limited to
--fixup=/--squash=subject suggestions, where fuzzy matching commit subjects is useful. Other commit completion paths keep their existing behavior.Related references:
:help matchfuzzy:help wildoptions, seefuzzyExamples
:Git switch fz<Tab>can match a narrower subset from a wider set of branch names, for example:
fuzzy-matchpotato-fuzzy:Git rebase hd<Tab>can match entries from the shared ref pool, for example:
FETCH_HEADfeature/hotdogorigin/feature/hotdog:Git commit --fixup=rdme<Tab>can match a commit subject like
update README formattingRequirements
matchfuzzy()(neovim or vim@9+).set wildoptions+=fuzzyTesting
This repo does not appear to have an automated test suite.
I have been using this locally on real repositories for a while without issues. Tested in both: neovim@0.12 and vim@9.