From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23050 invoked by alias); 8 Jan 2013 13:12:50 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17537 Received: (qmail 5228 invoked from network); 8 Jan 2013 13:12:48 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_05,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at yahoo.co.uk does not designate permitted sender hosts) X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 433687.865.bm@omp1038.mail.ird.yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1357650387; bh=wZbS+c4j8X5As6I2xB5CTTe6kZVSHmSXgYv0XPhwWMk=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=CxllMcglW4+nbZyaUbwZ+xJEkpJBI/aZA/kcTsC9RNPw0uyFl68/CoiQwKgvFSa/jYO6K53X5gMX3yo+bDozTmea2f3zna/CX8RBaSnrmh7YHZb52bDm6f6f2c5kLKvtFgVIUjXzDeY440IuYt9ZNvLW/A5jIAE3r7bzapvPYN8= DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=W3BxvTv30euios4OBhUUyGnayPSR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leHBhbmQgZ2xvYmFsIGFsaWFzZXMgaW5saW5lLAo.IGJlZm9yZSB0cnlpbmcgdG8gY29tcGxldGUgKGFuZCB0aHVzIGVuZGluZyB1cCBjb21wbGV0aW5nIGYBMAEBAQE- X-Mailer: YahooMailWebService/0.8.130.494 References: Message-ID: <1357650387.9070.YahooMailNeo@web171903.mail.ir2.yahoo.com> Date: Tue, 8 Jan 2013 13:06:27 +0000 (GMT) From: Oliver Kiddle Reply-To: Oliver Kiddle Subject: Re: completer that first expands global aliases (Re: dsf) To: Daniel , "zsh-users@zsh.org" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Daniel wrote:=0A> I have a nice little recent-files completer, see below.= =0A> (found here: http://michael.stapelberg.de/Artikel/zsh_recent_completio= n )=0A> =0A> What I would like to add to this, is for it to expand global a= liases inline,=0A> before trying to complete (and thus ending up completing= files in my aliased=0A> directory).=0A> =0A> I started trying to meld _gen= eric and _expand_alias, but with my lack of=0A> fluency in zsh, I just made= a mess :) Any help out there? Is there perhaps some=0A=0A> zstyle ':comple= tion:newest-files:*' completer _files=0A=0AYou can insert _expand_alias bef= ore _files in the list of completer=0Afunctions. I'm not sure if that works= in the way you want: a global=0Aalias will simply be expanded. If you trie= d that and it didn't work then=0AI would suspect that your default complete= r style is getting precedence=0Aover this one. Try using more colons instea= d of a *:=0A=0Azstyle ':completion:newest-files::::' completer _expand_alia= s _files=0A=0AIf this doesn't behave in the way you would like, perhaps giv= e us some=0Aexamples of your global aliases and what you behaviour you woul= d like.=0A=0A> zstyle ':completion:newest-files:*' file-patterns '*~.*(omN[= 1,12])'=0A> zstyle ':completion:newest-files:*' menu select yes=0A> zstyle = ':completion:newest-files:*' sort false=0A> zstyle ':completion:newest-file= s:*' matcher-list 'b:=3D*' # important=0A=0AI do this in a somewhat differe= nt way. The comment on the last line=0Aisn't particularly helpful. It makes= matching use substrings so for=0Aexample typing=0A=A0 ls pdfr=0Awi= ll match *pdf* in order of file modification. Note that matching is=0Adone = after the globbing so if you have more than 12 newer files than any=0Aof th= e matching ones, you won't get anything.=0A=0AI use _match instead so if I = want the most recent PDF file, I complete=0Aafter *.pdf. I also need the ma= tch-original style set for that to work.=0A=0AI can't think of a different = way to limit the number of matches to 12. I=0Asimply turn off completion li= sting for the widget and it is rare that I=0Aneed to cycle through more tha= n a couple of matches. This also has the=0Aadvantage that you can invoke re= verse-menu-complete to get the oldest=0Afile (which is sometimes useful).= =0A=0AI use the following:=0A=A0 zstyle ':completion:most-recent-*::::' com= pleter _menu _files _match=0A=A0 zstyle ':completion:most-recent-*:*' file-= sort modification=0A=A0 zstyle ':completion:most-recent-*:*' hidden all=0A= =A0 zstyle ':completion:(match-word|most-recent-*):*' match-original both= =0A=A0 zstyle ':completion:most-recent-file:*' file-patterns '*(.):normal\ = files'=0A=A0 zstyle ':completion:most-recent-dir:*' file-patterns '*(/):dir= ectories'=0A=A0 bindkey '^Xm' most-recent-file=0A=A0 bindkey '^XM' most-rec= ent-dir=0A=A0 zle -C most-recent-file menu-complete _generic=0A=A0 zle -C m= ost-recent-dir menu-complete _generic=0A=0ANote that I have a separate widg= et for directories. You may also want to=0Aexperiment with using _complete = instead of _files to make it more=0Aintelligent, at least in theory:=0A=A0 = zstyle ':completion:most-recent-*::::' completer _menu _complete _match=0A= =A0 zstyle ':completion:most-recent-file:*' file-patterns '%p(N):globbed-fi= les'=0A=0AOliver=0A