Skip to content

AutoComplete for ZSH

Tristan Morgan edited this page May 17, 2021 · 2 revisions

Awskeyring implements autocompletion functions internally but with ZSH this needs to ba called with a wrapper script. Place the script in your $fpath (eg. /usr/local/share/zsh/site-functions/_awskeyring) and zsh will load it when starting a new shell with autoload -U +X compinit && compinit.

#compdef awskeyring

_awskeyring() {
  export COMP_LINE="$BUFFER"
  export COMP_POINT="$(echo -n $COMP_LINE | wc -m)"
  compadd $(/usr/local/bin/awskeyring awskeyring "${words[-1]}" "${words[-2]}")
}

_awskeyring "$@"

P.S. if someone has a better way please tell me.

Clone this wiki locally