How to set up zsh autocompletion correctly?

816 Views Asked by At

I'm having some trouble setting up the zsh shell correctly. My .zshrc looks like this

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
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

source "$HOME/prg/external/zsh-autocomplete/zsh-autocomplete.plugin.zsh"

export ZSH="$HOME/.oh-my-zsh"
export ZSH_CONFIG_DIR="$HOME/.config/zsh"

ZSH_THEME="powerlevel10k/powerlevel10k"

plugins=(
    git
    zsh-vi-mode 
    zsh-history-substring-search 
    zsh-syntax-highlighting
)

source "$ZSH/oh-my-zsh.sh"

source "$ZSH_CONFIG_DIR/aliases_and_exports.sh"
source "$ZSH_CONFIG_DIR/setup_pyenv.sh"
source "$ZSH_CONFIG_DIR/setup_yabai.sh"
source "$ZSH_CONFIG_DIR/setup_autocompletion.sh"

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

As you can see I use four zsh-plugins zsh-vi-mode, zsh-history-substring-search, zsh-autocomplete, and zsh-syntax-highlighting. According to the GitHub of zsh-autocomplete I should be able to change the behaviour of how the autocomplete works, by adding some commands to the .zshrc (see $ZSH_CONFIG_DIR/setup_autocomplete.sh), i.e.

zstyle ':compinit' arguments -D -i -u -C -w
autoload -U compinit && compinit
bindkey '^I' menu-select "$terminfo[kcbt]" menu-select
bindkey -M menuselect '^I' menu-complete "$terminfo[kcbt]" reverse-menu-complete

and according to the developer this should Make Tab go straight to the menu and cycle there, but when I try to do this, Tab does not cycle through the menu but Shift+Tab works.

On top of that, writing something (e.g. echo $HOME_) in the shell and then pressing the Up key to go through the history of the commands, which start with what has been written already (e.g. echo $HOME_A, then echo $HOME_B, etc), does not work anymore.

Do I need to to anything special before or after the bindkey command works on macOS? Any idea what is going on here?

0

There are 0 best solutions below