zsh-users / zsh-completions

Additional completion definitions for Zsh.
Other
6.9k stars 713 forks source link

The "common substring" should include only the prefix, not the suffix #1023

Closed cohml closed 1 year ago

cohml commented 1 year ago

Consider the following directory:

❯ ls -1
foo_a.sh
foo_b.sh

Here is what zsh-autocomplete displays regarding these files:

image

If I hit TAB, the "common substring" shown above is autocompleted for me:

❯ ls foo_.sh

Note that the autocompleted text includes both the common prefix foo_ and the common suffix .sh.

But this isn't useful. There is no file called foo_.sh, so after this text is autocompleted, I have to reason about which characters are now missing, move my cursor back to that position, and type them all in. And if that file isn't the end of my command, then I have to move the cursor back to the end to continue the command.

So the current "common substring" autocompletion entails lots of unnecessary cursor movement. Much better would be to complete only the common prefix foo_, then let me add another character to narrow down what I want, then press tab to complete to the end.

Is this prefix + suffix completion behavior a bug in the plugin? Or is it something that I can configure? The docs didn't provide the answer for this.

cohml commented 1 year ago

I'm sorry, it seems I accidentally filed this issue with the wrong repository - d'oh! Closing it now.