From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 975 invoked from network); 29 Jun 2004 21:40:30 -0000 Received: from odin.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.85) by ns1.primenet.com.au with SMTP; 29 Jun 2004 21:40:30 -0000 Received: (qmail 18355 invoked from network); 29 Jun 2004 22:50:57 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 29 Jun 2004 22:50:57 -0000 Received: (qmail 1067 invoked by alias); 29 Jun 2004 21:39:42 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7622 Received: (qmail 1057 invoked from network); 29 Jun 2004 21:39:42 -0000 Received: from odin.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.85) by sunsite.dk with SMTP; 29 Jun 2004 21:39:42 -0000 Received: (qmail 17481 invoked from network); 29 Jun 2004 22:50:33 -0000 Received: from red-hots.cs.utk.edu (160.36.57.114) by a.mx.sunsite.dk with SMTP; 29 Jun 2004 22:50:24 -0000 Received: by red-hots.cs.utk.edu (Postfix, from userid 10605) id 816EBE55F; Tue, 29 Jun 2004 17:39:29 -0400 (EDT) Date: Tue, 29 Jun 2004 17:39:28 -0400 From: Chris Johnson To: zsh-users@sunsite.dk Subject: Re: users@hosts completion Message-ID: <20040629213928.GA5554@red-hots.cs.utk.edu> References: <20040627121512.GC22418@red-hots.cs.utk.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 Bart Schaefer wrote: > On Sun, 27 Jun 2004, Chris Johnson wrote: > > > How can I setup users-hosts completion for my specified commands? > > Unfortunately you can't set this up with zstyles only, because it relies > on a special utility function called _combination which has to be called > in the correct way from the function that generates potential matches for > the command in question. [...] > If it happens that your command has argument syntax very similar to one of > the commands that already uses users-hosts completion, then you can tell > the completion system to treat completion for your command exactly the > same as completion for that other command. You do that with a "compdef" > command like so: > > compdef mynewcommand=telnet This works beautifully. My command is just a wrapper to scp, written to help prevent overwriting of files. Too many times I've omitted the remote destination argument--i.e., scp source1 source2--and overwritten source2 with source1. (I'm not aware of any interactive option for scp like there is for cp.) So, this command lends itself perfectly to compdef. I am in your debt. Thank you! -- Chris Johnson cjohnson@cs.utk.edu http://www.cs.utk.edu/~cjohnson