Zsh completion configuration

From wikinotes

Documentation

completion system configuration https://man.archlinux.org/man/extra/zsh/zshall.1.en#COMPLETION_SYSTEM_CONFIGURATION
format string types https://man.archlinux.org/man/extra/zsh/zshall.1.en#SIMPLE_PROMPT_ESCAPES

Tutorials

completion formatting tut https://thevaluable.dev/zsh-completion-guide-examples/

Loading Completions

fpath=(~/.zsh/completion $fpath) # add completion dir to $fpath
autoload -U compinit             # init autocompletion
compinit

The cleanest way to reload your autocompletion script is:

  • open a new terminal
  • autoload -U ~/.zsh/completion/_yourcompleter:t

Customizing Completion Display

zstyle ':completion:*:*:*:*:descriptions' format '%F{green}-- %d --%f'

colours

%F{green}...%f: fg colour
%K{green}...%f: bg colour
%B...%b:        bold
%U...%u:        underline
%d: description
%f: