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

Re: new completion modifications



--- Scott Lipcon <slipcon@xxxxxxxxxx> wrote:

> Second, is there an easy way to limit my $hosts expansions to telnet,
> rlogin, 
> ftp, etc, and $sshhosts to ssh, scp, etc?  using the above zstyles,
> they are 
> all thrown in one completion basket.

You can do this by using different contexts with the zstyle command.
For completion, contexts are of the form:
:completion:<function>:<completer>:<command>:<arg>:<tag>
(this line is so useful that I keep it in a comment in my .zshrc)
so we can use a context which restricts the command. So you can use
something like:

  zstyle '*' hosts $hosts
  zstyle ':completion:*:*:(ssh|scp):*' hosts $sshhosts

In the second zstyle, the context is more specific so when it matches
(for the ssh and scp commands), it will be used instead of the first
zstyle which will work in other cases.

You could similarly use a different context for hosts to use with other
programs like telnet, lynx, netscape etc.

There are also a few other styles you might find useful. Look-up the
users-hosts, users-hosts-ports, local and path styles in the manual.
That should give you the "magic zstyles" for urls.

Note to -workers - should _ssh be completing for ssh1 and ssh2 too?

It'll be quite possible to add other options to _rlogin but I'm not
familiar with any of the options beyond -l so I'll leave it to someone
else. Ideally, we would want to be able to work out if rlogin supports
kerberos so we know which set of options to complete.

Oliver



____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



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