Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: help with _match, globcomplete etc. (with a PATCH)
- X-seq: zsh-workers 9762
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxxxxxxxxx>
- Subject: Re: help with _match, globcomplete etc. (with a PATCH)
- Date: Wed, 16 Feb 2000 11:52:06 +0000
- In-reply-to: <38AA7E36.135EBD1E@xxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <200002151608.RAA14415@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <38A9AECE.5B213E7@xxxxxxxxxxxxx> <1000216064743.ZM18361@xxxxxxxxxxxxxxxxxxxxxxx> <38AA7E36.135EBD1E@xxxxxxxxxxxxx>
On Feb 16, 10:38am, Oliver Kiddle wrote:
} Subject: Re: help with _match, globcomplete etc. (with a PATCH)
}
} The reason I wanted this is basically that I use a number of associative
} arrays to point to different areas of the system I work on. [...]
}
} [...] This leads me to make a suggestion which may or may not be easy
} but would solve my problems: in the same way as a variable whose
} value is a directory can be refered to with ~, could the same be made
} to work for associative arrays (and arrays in general I suppose),
} allowing me to use stuff like ~code[ai] and ~test[$area]?
Hrm. You can already manually stuff things into the nameddir hash:
zagzig% unsetopt glob
zagzig% typeset -A xx
zagzig% xx=($(print -l $path | cat -n))
zagzig% echo $xx[9]
/usr/etc
zagzig% for x in ${(k)xx}; hash -d xx[$x]=$xx[$x]
zagzig% cd ~xx[9]<TAB>
zagzig% cd ~xx[9]/
Well, would you look at that. But if there I press return, I get:
cd: no such file or directory: ~xx[9]
That's because the [ and ] are tokenized most of the time, so they don't
match what has been added to the hash even if the typtab is modified to
treat them as IUSER. It's probably an accident that the trailing slash
gets added that first time; you can't complete any further after it.
So it may be possible to make this work by using a more sophisticated
parse than simply scanning past all the IUSER characters, and then
throwing in a few calls to untokenize(); but I don't think I'm going to
attempt it.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author