jeroen.se
by jnieuwen
configuring command line completion in zsh
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
0 comments

Nick:
Email:
Make your own addition with integers (needed to make sure you aint a spambot):
+ =
Categories
Cycling (2)
Gadgets (3)
Misc (22)
Scripting (23)
Travel (7)
Unix (24)
Archive
April 2010 (2)
January 2010 (1)
December 2009 (1)
November 2009 (2)
May 2009 (1)
April 2009 (1)
March 2009 (1)
February 2009 (7)
January 2009 (3)
December 2008 (1)
November 2008 (4)
October 2008 (5)
September 2008 (1)
August 2008 (3)
July 2008 (2)
June 2008 (2)
May 2008 (3)
April 2008 (1)
March 2008 (1)
February 2008 (1)
January 2008 (4)
December 2007 (1)
November 2007 (7)
October 2007 (4)
September 2007 (1)
August 2007 (2)
June 2007 (6)
May 2007 (8)