Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: completion tricks



Marius Strom (marius@xxxxxxxxxx) wrote:
> On Mon, Mar 19, 2001 at 01:14:54PM -0700, Jeff Shipman wrote:
> > I was wondering how to set up some completion tricks like
> > these:
> > 
> > 1) Using 'man' will complete different man pages
> > 
> > 2) Using ssh, rlogin, telnet, etc will complete
> >    different hosts on my network.
>
> Jeff,
> I did the second portion as thus in my .zshrc:
> 
> hosts=( host1 host2 host3.fqdn.com )
> compctl -k hosts ssh ftp telnet ping traceroute mtr rlogin rsh

Or if you're using a development version (highly recommended), forget
compctl altogether, and do `autoload compinstall; compinstall' to
install the new completion system, which is much better.

Completion of man pages should then work automatically.  You can
also configure ssh etc. like so:

  # All my accounts:
  my_accounts=(
    {joe,root}@mymachine.com
    jbloggs@xxxxxxxxxxxxxxxxxx
  )

  # Other people's accounts:
  other_accounts=(
    {fred,root}@hismachine.com
    vera@xxxxxxxxxxxxxx
  )

  zstyle ':completion:*:my-accounts' users-hosts $my_accounts
  zstyle ':completion:*:other-accounts' users-hosts $other_accounts

  telnet_users_hosts_ports=(
    user1@host1:
    user2@host2:
    @mail-server:{smtp,pop3}
    @news-server:nntp
    @proxy-server:8000
  )

  zstyle ':completion:*:*:telnet:*' users-hosts-ports $telnet_users_hosts_ports

Note to zsh-workers: it looks like completion within the -l option of
telnet is broken.



Messages sorted by: Reverse Date, Date, Thread, Author