Given an example wrapper shell function:
app() {
setsid "$@"
}
In Bash, you can do complete -F _command app
to automatically give app
completions for all commands (not just binaries on the path but also the arguments afterwards).
How can you do this in ZSH? I have some leads with _normal
and -command-line-
but I've been unable to figure out the correct command to put in a .zshrc
.
Update:
Just wanted to document something interesting, this produces a SIGSEGV:
autoload -U compinit && compinit
compdef _normal app
# Attempt tab completion of app:
# _normal:1: maximum nested function level reached; increase FUNCNEST?
FUNCNEST=999
# Attempt tab completion of app again
# !!! ZSH crashes (see coredumpctl) !!!