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

Re: ytalk completion



Bek Oberin wrote:
> 
> Okay, I've figured out completion on ssh/telnet/etc. by means
> of an array of my favorite hosts.  But how can I do
> the same for ytalk?
> 
> ie  I type
>    ytalk matt@ne<tab>
> 
> and it completes the after-the-@-sign bit from the hosts array?

The incantation is

  compctl -s '`users`' -x 'n[1,@]' -k hosts -- ytalk

or something such (whatever array name you've used for the hosts).
This is the canonical use for the 'n[...]' completion, so here's a
patch adding this example to the manual page.  (You need yodl for this
to get through to the installable manual page.)  Hope this doesn't
clash with other manual patches this time.

*** Doc/Zsh/compctl.yo.next	Sun Jan 11 00:28:51 1998
--- Doc/Zsh/compctl.yo	Sat Oct 10 14:48:05 1998
***************
*** 474,480 ****
  including the var(index)th occurrence of this string will not be
  considered part of the completion, but the rest will.  var(index) may
  be negative to count from the end: in most cases, var(index) will be
! 1 or -1.
  )
  item(tt(N[)var(index)tt(,)var(string)tt(])...)(
  Like tt(n) except that the string will be
--- 474,487 ----
  including the var(index)th occurrence of this string will not be
  considered part of the completion, but the rest will.  var(index) may
  be negative to count from the end: in most cases, var(index) will be
! 1 or -1.  For example,
! 
! nofill(tt(compctl -s '`users`' -x 'n[1,@]' -k hosts -- talk))
! 
! will usually complete usernames, but if you insert an tt(@) after the
! name, names from the array var(hosts) (assumed to contain hostnames,
! though you must make the array yourself) will be completed.  Other
! commands such as tt(rcp) can be handled similarly.
  )
  item(tt(N[)var(index)tt(,)var(string)tt(])...)(
  Like tt(n) except that the string will be


-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarotti 2, 56100 Pisa, Italy



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