Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should complete exact prefix before fuzzy matches #301

Closed
vitaly opened this issue Jul 14, 2021 · 6 comments
Closed

Should complete exact prefix before fuzzy matches #301

vitaly opened this issue Jul 14, 2021 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@vitaly
Copy link

vitaly commented Jul 14, 2021

  • zsh-autocomplete version: b164ae7
  • Zsh version: /usr/local/bin/zsh zsh-5.8-0-g77d203f
  • Framework: zim
  • Plugin manager: none
  • Operating system: darwin19.6.0

| BTW, the above, imho, should be generated by a command

the problem:

I'm very fast at the keyboard, and used to type ahead, not waiting for shell to catch up.

Since switching to zsh-autocomplete shell frequently does something very unexpected.

Where it comes to autocompletion, there is a lot of 'muscle memory' and default expectation as to how such a system supposed to work. For example, if I type something that is an exact prefix of some completion, then I expect it to be used when I press tab.

Here is an example:

I have 2 aliases git-merged which shows branches merged into current, and git-clean-merged which deletes those branches. I usually run git-merged first ;).
To my surprise, when I typed git-mer<tab><enter> it got git-clean-merged executed.

Another frequent problem is when I need to change into a directory, and I type couple of first letters, knowing there are no other directories with the same prefix, then <tab><enter>, and then taken to some random unexpected place, because it got completed from history or something.

test script:

cd $(mktemp -d -t autest)
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
print '
PS1="%# " PS2="  " RPS2="< %^"; setopt transientrprompt
alias git-merged=true
alias git-clean-merged=false
source ~/zsh-autocomplete/zsh-autocomplete.plugin.zsh
' > .zshrc
exec env -i HOME=$PWD TERM=$TERM SHELL=$SHELL $SHELL -d

result

% git-me
alias
git-clean-merged  git-merged

At this point (or even before the completion appears) if I press tab it will complete git-clean-merged, which I think is wrong, when an exact prefix completion exists.

@vitaly vitaly added the bug Something isn't working label Jul 14, 2021
@marlonrichert marlonrichert added enhancement New feature or request and removed bug Something isn't working labels Jul 17, 2021
@marlonrichert marlonrichert self-assigned this Jul 17, 2021
@marlonrichert
Copy link
Owner

BTW, the above, imho, should be generated by a command

Can you give examples of GitHub repos where this is done that way? I would like to see if there's any standard or conventions for this, instead of just making up my own.

@marlonrichert
Copy link
Owner

Implemented.

@marlonrichert
Copy link
Owner

PS: If you enjoy using this software, please consider becoming a sponsor. 🙂

@vitaly
Copy link
Author

vitaly commented Jul 21, 2021

PS: If you enjoy using this software, please consider becoming a sponsor. 🙂

done ;)

@vitaly
Copy link
Author

vitaly commented Jul 21, 2021

BTW, the above, imho, should be generated by a command

Can you give examples of GitHub repos where this is done that way? I would like to see if there's any standard or conventions for this, instead of just making up my own.

No. I just think that instead of copy pasting commands to and from terminal, running something like zsh-autocomplete-bug-report would be more convenient ;)

@marlonrichert
Copy link
Owner

Sure, I can add some kind of command for that.

@marlonrichert marlonrichert changed the title should complete exact prefix before fuzzy matches Should complete exact prefix before fuzzy matches Aug 9, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants