Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: The (e) glob qualifier and NO_NOMATCH
- X-seq: zsh-workers 22510
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: The (e) glob qualifier and NO_NOMATCH
- Date: Fri, 23 Jun 2006 11:53:17 +0200
- In-reply-to: <060622095121.ZM19569@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <060621064945.ZM17820@xxxxxxxxxxxxxxxxxxxxxx> <3849.1150985542@dcle12> <060622095121.ZM19569@xxxxxxxxxxxxxxxxxxxxxx>
Bart wrote:
> Rather I'm thinking in terms of the "search upwards but stop at the
> first file" glob request posted to zsh-users earlier this week. I
> wanted to say
>
> up() { reply=( (../)#$~REPLY(Odon) ); reply=( $reply[1] ) }
>
> less adr*(+up)
The closest I can think of that you can get to this is something like
the following:
up() { print -r "(../)#$1(Odon[1])" }
alias up='noglob up'
less ${~$(up adr*)}
That's not much easier to type but it might make more sense to allow
something like $~(up d*) to work than to add a glob qualifier that
alters the pattern.
In the case of the actual searching upwards problem, I've wondered in
the past whether some actual syntax would make sense. I mostly use it
for getting to Ant build.xml files and have considered using bindkey -s
so that something like '.**/' would expand to '(../)#'. A new syntax
could perhaps work a little differently than '(../)#' to avoid needing
(Odon[1]) or ([-1]). Stopping at the first directory that produces a
match is probably enough (searching up from .. to / not down from / to
..).
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author