zsh-autosuggestions icon indicating copy to clipboard operation
zsh-autosuggestions copied to clipboard

Only display unambiguous suggestions

Open AndrewC-B opened this issue 5 years ago • 3 comments

I set ZSH_AUTOSUGGEST_STRATEGY=(completion) and would like to configure zsh-autosuggestions or zsh itself so that only unambiguous suggestions are displayed. e.g. cd D would show no suggestion (because D matches both ~/Desktop and ~/Downloads), but cd De would show the completion sktop/. Is this possible?

I've had a look at the zsh documentation and the code for this plugin, but I have to admit that I'm a little lost. Any help would be much appreciated. Thanks!

AndrewC-B avatar Feb 24 '20 23:02 AndrewC-B

It's not possible in an official way right now. I'll have to think about the best way to support this use case.

The ambiguous suggestions are forced by setting compstate[insert] in _zsh_autosuggest_capture_postcompletion so as a temporary workaround you can redefine that function after sourcing the plugin (but you probably shouldn't do this long-term since that's a private function that may change without warning in future versions):

_zsh_autosuggest_capture_postcompletion() {
  unset 'compstate[list]'
}

ericfreese avatar Feb 24 '20 23:02 ericfreese

Thanks! That's a great workaround. If you support this officially please post something here :)

AndrewC-B avatar Feb 24 '20 23:02 AndrewC-B

Big fan of this request! I am looking forward to the official support.

mvcouwen avatar Sep 08 '22 20:09 mvcouwen