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

How to disable autosuggestion when having autocompletion selected?

Open beyond-fu opened this issue 10 months ago • 1 comments

I'm using zsh-autosuggestion and zsh-autocompletion. I just installed the latest zsh-autosuggestion and zsh-autocompletion on Fedora41. When I select a completion candidate item, the suggusetion is still there and this is annoying. So I want to know how to make suggestion not showing when one of the completions is selected.

Before enter Tab to complete: Screenshot From 2024-12-11 01-30-40 After completion: Screenshot From 2024-12-11 01-30-56

Below is my .zshrc configuration:

if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

HISTFILE=~/.zsh_histfile
HISTSIZE=1000
SAVEHIST=2000
bindkey -v    
setopt autocd extendedglob nomatch
unsetopt beep notify

# Snap: zsh plugins manager
[[ -r ~/zsh_plugins/znap/znap.zsh ]] ||
    git clone --depth 1 -- \
        https://github.com/marlonrichert/zsh-snap.git ~/zsh_plugins/znap
source ~/zsh_plugins/znap/znap.zsh  # Start Znap

znap source marlonrichert/zsh-autocomplete
znap source zsh-users/zsh-autosuggestions
znap source zsh-users/zsh-syntax-highlighting

source ~/zsh_plugins/powerlevel10k/powerlevel10k.zsh-theme
. "$HOME/.cargo/env"

bindkey "^[[1;5C" "forward-word"
bindkey "^[[1;5D" "backward-word"
bindkey              '^I' menu-select
bindkey "$terminfo[kcbt]" menu-select
bindkey -M menuselect              '^I'         menu-complete
bindkey -M menuselect "$terminfo[kcbt]" reverse-menu-complete
bindkey  "^[[H"   beginning-of-line
bindkey  "^[[F"   end-of-line
bindkey  "^[[3~"  delete-char

zstyle ':autocomplete:*complete*:*' insert-unambiguous yes
zstyle ':autocomplete:*history*:*' insert-unambiguous yes
zstyle ':completion:*:*' matcher-list 'm:{[:lower:]-}={[:upper:]_}' '+r:|[.]=**'

zstyle -e ':autocomplete:*:*' list-lines 'reply=( $(( LINES / 2 )) )'
zstyle ':completion:*:messages' format $'\e[01;35m -- %d -- \e[00;00m'
zstyle ':completion:*:warnings' format $'\e[01;31m -- No Matches Found -- \e[00;00m'
zstyle ':autocomplete:*' ignored-input '..##'

[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

Thanks!

beyond-fu avatar Dec 10 '24 17:12 beyond-fu