I have a bunch of aliases like this

alias -g foo=cmd1
alias -g faz=cmd2
alias -g fam=cmd3

At the shell (I'm using zsh) I want to be able to type

echo fa<TAB>

and be prompted for faz or fam

complete_aliases option doesn't seem right (and didn't work) and compdef is for completion for cmd* not to complete the alias name itself.

If I use the aliases at the beginning of a line they do offer tab completion. It's only when it's used somewhere else in the line.

Functions like oh-my-zsh's globalias works for expanding the alias after I type the full name and push space but I'm looking for something that will expand the alias if I don't remember the full name of it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.