Interaction with completion menu #118
This is what I was referring to as "minor issues with the buffer displaying incorrectly while inside menu selection" in this comment, but I never created a separate issue for the problem.
Using menu selection is what causes this issue. I believe this is the minimal .zshrc config to reproduce this problem:
autoload compinit && compinit
zstyle ':completion:*' menu select
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
I haven't yet found a way to bind to a menu selection event to clear/update the suggestion. Probably will need to dig into this document to find a solution.
As far as I know, there are two options to workaround this issue temporarily:
- Don't use menu selection. Remove the zstyle line above or set the menu style to
no-selectwithzstyle ':completion:*' menu no-select. This will keep suggestions working while doing completions. - Add your bound completion widget(s) (
expand-or-completein your case) to the list of widgets that clear the suggestion. This will have the effect of disabling suggestions while you're in menu selection, but at least it won't leave a lingering, broken suggestion. AddZSH_AUTOSUGGEST_CLEAR_WIDGETS+=("expand-or-complete")somewhere in your.zshrcafter sourcing this plugin.
We may want to add expand-or-complete to ZSH_AUTOSUGGEST_CLEAR_WIDGETS by default, but I believe that would break suggestions for folks not using menu selection, so I think this belongs in individual user configuration for now.
This should be fixed in v0.3.2 (just released) by commit e87bc74
When it inserts the current choice from the completion menu, the grey autosuggest sticks around and changes to the normal color. See https://asciinema.org/a/ateiyie18acvm3l7srfezt89g for a screencast of the behavior. bindkey '^I' is expand-or-complete.