TAB
all the way.
initialize the completion system
1compinit -d ${XDG_CACHE_HOME:-$HOME}/.zcompdump
using a shell function generate completions
1compdef function_to_use commands to complete
2
3# when used as the first line of an autoloaded function found during compinit
4#compdef ...
5
6# reuse completions created for command2 for command1
7compdef command1=command2
8# ex:
9alias tf=terraform
10compdef tf=terraform
use bash completion in zsh
call after compinit
1bashcompinit
how to complete commands
1complete -o option -[CF] command
2
3# commonly used to not add extra space
4-o nospace
5
6complete -C command_output_used_as_completion command
7complete -F function_output_used_as_completion command