Interaction with completion menu #118

Closed
kergoth opened this Issue Feb 15, 2016 · 3 comments

2 participants

@kergoth

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.

@ericfreese
zsh-users member

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:

  1. Don't use menu selection. Remove the zstyle line above or set the menu style to no-select with zstyle ':completion:*' menu no-select. This will keep suggestions working while doing completions.
  2. Add your bound completion widget(s) (expand-or-complete in 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. Add ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=("expand-or-complete") somewhere in your .zshrc after 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.

@kergoth

Ah! Thanks for the detailed and quick response, much appreciated.

@0xbzho 0xbzho added a commit to 0xbzho/asciinema.org-2016-02 that referenced this issue Mar 1, 2016
Christopher Larson zsh autosuggestions / completion menu interaction
See zsh-users/zsh-autosuggestions#118 ( zsh-users/zsh-autosuggestions#118 ) . This is worked around by setting ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(expand-or-complete), per the comment on that issue. Thanks to ericfreese for the quick and thorough response and supplied workaround.
f5efa6b
@ericfreese
zsh-users member

This should be fixed in v0.3.2 (just released) by commit e87bc74

@ericfreese ericfreese closed this May 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment