Sunday I wrote about configuring your prompt in
zsh and I promised to write
about configuring the more advanced commandline completions in
zsh. This is
in fact quite simple. Adding
autoload -U compinit
compinit to
~/.zshrc
takes care of most of it. However I also wanted command line completion for
hosts not in my
/etc/hosts file and for usernames I have on other
hosts/networks.
To extend the username completion you have to add the usernames to your
~/.zshrc with the following construct:
zstyle ":completion:*" users jnieuwen root
where jnieuwen and root are of course the usernames you want autocompletion on.
The construct for the hostname completion is almost the same:
zstyle ":completion:*" hosts alberich.jeroen.se hermod.jeroen.se