From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20726 invoked from network); 11 Oct 2006 16:39:12 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.6 (2006-10-03) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.6 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 11 Oct 2006 16:39:12 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 53528 invoked from network); 11 Oct 2006 16:39:04 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 11 Oct 2006 16:39:04 -0000 Received: (qmail 5589 invoked by alias); 11 Oct 2006 16:38:54 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10830 Received: (qmail 5580 invoked from network); 11 Oct 2006 16:38:53 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 11 Oct 2006 16:38:53 -0000 Received: (qmail 52202 invoked from network); 11 Oct 2006 16:38:53 -0000 Received: from vms040pub.verizon.net (206.46.252.40) by a.mx.sunsite.dk with SMTP; 11 Oct 2006 16:38:52 -0000 Received: from torch.brasslantern.com ([71.116.118.106]) by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0J6Z007I9CWEJ3UZ@vms040.mailsrvcs.net> for zsh-users@sunsite.dk; Wed, 11 Oct 2006 11:38:39 -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 k9BGccwZ018051 for ; Wed, 11 Oct 2006 09:38:38 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id k9BGcbmB018050 for zsh-users@sunsite.dk; Wed, 11 Oct 2006 09:38:37 -0700 Date: Wed, 11 Oct 2006 09:38:37 -0700 From: Bart Schaefer Subject: Re: Why doesn't tab expand . In-reply-to: To: zsh-users@sunsite.dk Message-id: <061011093837.ZM18049@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 zzapper "Re: Why doesn't tab expand ." (Oct 11, 9:13am) On Oct 11, 9:13am, zzapper wrote: } } zzapper wrote in news:Xns9857CE0FC8AA4zzappergmailcom@ } 80.91.229.5: } } > cp /tmp/fred.txt . } expanding to:- } > cp /tmp/fred.txt fred.txt } } Which I could then arbitrarily choose to modify. } } Someone has pointed out that . means current directory, so I guess it } would be imoral Well, not immoral, just ambiguous. You have to assert via zstyles or compdef that "." should not be considered a valid completion by itself, and then assert by an entry in the matcher-list zstyle that it's OK to complete both sides around a dot without having any other clues. Although ... it looks like specifically what you want is not for "." to complete, but for "cp" completion to insert the tail of the source path argument as the default target argument? _mycp () { if [[ $CURRENT -ge $#words && $words[CURRENT-1] = */* ]] then compadd $words[CURRENT-1]:t fi _cp } compdef _mycp cp This could be refined in several ways, e.g., you might prefer if [[ $CURRENT -ge $#words && $words[CURRENT-1] = */* && $words[CURRENT] != */* ]]