From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3031 invoked from network); 23 Feb 2003 01:48:25 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 23 Feb 2003 01:48:25 -0000 Received: (qmail 5359 invoked by alias); 23 Feb 2003 01:47:32 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5935 Received: (qmail 5337 invoked from network); 23 Feb 2003 01:47:32 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 23 Feb 2003 01:47:32 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [4.64.233.231] by sunsite.dk (MessageWall 1.0.8) with SMTP; 23 Feb 2003 1:47:31 -0000 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id h1N1lUX11490 for zsh-users@sunsite.dk; Sat, 22 Feb 2003 17:47:30 -0800 From: "Bart Schaefer" Message-Id: <1030223014730.ZM11489@candle.brasslantern.com> Date: Sun, 23 Feb 2003 01:47:30 +0000 In-Reply-To: <20030213145737.GF2260@fruitcom.com> Comments: In reply to Eric Smith "Re: echo-ing case insensitively" (Feb 13, 3:57pm) References: <20030212225953.GA2479@fruitcom.com> <1030213045937.ZM6783@candle.brasslantern.com> <20030213145737.GF2260@fruitcom.com> X-Mailer: Z-Mail (5.0.0 30July97) To: Zsh Users Subject: Re: echo-ing case insensitively MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii [I've been on vacation for a week, hence the long delay in responding ... also, I've just noticed that my machine rebooted with the clock off by an hour, so this message may appear to have been sent before others I sent earlier. Sigh.] On Feb 13, 3:57pm, Eric Smith wrote: > > > Well I find directories that enforce a one-dimensional hierarchy > very restrictive and maps poorly to the real world. Accordingly > I use underscores in filenames to create "namespaces" like others would > create dirs. But the freedom of not using directories allows files > to live under many different classes or categories simultaneously. I was under the impression that this is what "ln" was for. How do you go about getting a list of existing classes or categories? Not of the files within one of them, but of the classes themselves? > Nest challenge would be to give se() multiple words and it will match > any file with those strings in it You've got a basic design problem there, in that "se" as you previously specified it can already be given multiple words: it treats two words as a directory name followed by a file substring. I take it you want the files that have ALL of the specified words in the name, in any order, rather than files that have ANY of the words? ANY of the words is something like: se () { setopt localoptions extendedglob noshwordsplit print -l **/(#i)*(${(j:|:)~${(q)*}})* } ALL of the words, in any order, pretty much requires a loop: se () { setopt localoptions extendedglob noshwordsplit local -a possible; possible=( **/(#i)*$1* ) shift while (( $# )) do possible=( ${(M)possible:#(#i)*$1*} ) shift done (( $#possible )) && print -l $possible } Your original question: > I want to type `draft' at the prompt and press and then > get all the options above to show as possible expansions. I'm going to presume you mean you want this at any place where a file name would normally be completed. To accomplish this, you have to create a completer to replace the supplied `_files' completer. Something like this: _files () { local -a possible possible=( $(se $words[CURRENT]) ) if (( $#possible )) then compadd -f -U -a -- possible else # Copy entire content of supplied _files here fi } It's rather too bad that _files doesn't have a _dispatch hook the way _value and _redirect do ... but even that would apply only in 4.1.x, not 4.0.x. There may be some way to accomplish what you want using a matcher-list entry, but I haven't been able to work out what it would be. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net