From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27737 invoked from network); 15 Apr 2007 18:58:19 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.8 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 15 Apr 2007 18:58:19 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 98266 invoked from network); 15 Apr 2007 18:58:13 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 Apr 2007 18:58:13 -0000 Received: (qmail 3268 invoked by alias); 15 Apr 2007 18:58:04 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11397 Received: (qmail 3257 invoked from network); 15 Apr 2007 18:58:03 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 15 Apr 2007 18:58:03 -0000 Received: (qmail 97047 invoked from network); 15 Apr 2007 18:58:03 -0000 Received: from vms042pub.verizon.net (206.46.252.42) by a.mx.sunsite.dk with SMTP; 15 Apr 2007 18:58:00 -0000 Received: from torch.brasslantern.com ([71.116.88.130]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JGJ0064RZC794P5@vms042.mailsrvcs.net> for zsh-users@sunsite.dk; Sun, 15 Apr 2007 13:57:44 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id l3FIvg6V027670 for ; Sun, 15 Apr 2007 11:57:43 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id l3FIvg4H027669 for zsh-users@sunsite.dk; Sun, 15 Apr 2007 11:57:42 -0700 Date: Sun, 15 Apr 2007 11:57:42 -0700 From: Bart Schaefer Subject: Re: completion help In-reply-to: To: zsh-users@sunsite.dk Message-id: <070415115742.ZM27668@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: Comments: In reply to "Michael Drzal" "completion help" (Apr 14, 10:08am) On Apr 14, 10:08am, Michael Drzal wrote: } } % ssh host } host host.regular host.inband host.outofband } } I realize that I could enumerate all of the possible hosts with the } hosts style, but this seems like overkill. Is there some way that I } could do something like: } } zstyle context domains domain1 domain2 domain3 ... } } and get the effect that I'm looking for? zstyle -e ':completion:*:(ssh|scp):*' hosts \ 'reply=( ${${words[CURRENT]%.*}#*@}.{domain1,domain2,domain3,...} )' This will complete the domains directly (with a leading dot) if you have't already typed the host part. A conditional test on $words[CURRENT] could be added to set reply only if there is already at least one dot. Additional complexity is of course possible. You might also want to put the list of domain names in a variable where it's more easily edited: host_domains=( domain1 domain2 domain3 ... ) zstyle -e ':completion:*:(ssh|scp):*' hosts \ '[[ $words[CURRENT] = *.* ]] && reply=( ${${words[CURRENT]%.*}#*@}.${^host_domains} )' If you're starting to get really complex conditions, I suggest putting them into a function and replacing the string value of the style with a call to the function.