From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: New completions
Date: Fri, 18 Jun 1999 12:01:39 +0200 (MET DST) [thread overview]
Message-ID: <199906181001.MAA13055@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Kiddle, Oliver"'s message of Fri, 18 Jun 1999 10:30:48 +0100
Kiddle, Oliver wrote:
> The other patch (for _subscript) is a bit messy and can almost certainly be
> improved. Basically it completes the index in an array by using -y to
> supply a list of each array element. I find it very useful for pulling
> single directories out of $manpath, $fpath etc.
This didn't apply after 6689, so here is a modified patch for that --
with some other changes (I hope you find them acceptable). The list
looks more like a select list and I avoided using `compgen -s'.
Hm, `compgen -s', maybe we should document it that this is almost
always unnecessary (after 6692). Or maybe we should even disallow the
`-s' option for `compgen'.
BUT: thank you for sharing your completion functions with us. I'd like
to see more of this.
Bye
Sven
--- oc/Base/_subscript Thu Jun 17 12:04:14 1999
+++ Completion/Base/_subscript Fri Jun 18 11:55:00 1999
@@ -1,10 +1,25 @@
#compdef -subscript-
+local list ind
+
if [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then
if [[ "$RBUFFER" = \]* ]]; then
compadd -S '' - "${(@kP)${compstate[parameter]}}"
else
compadd -S ']' - "${(@kP)${compstate[parameter]}}"
+ fi
+elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then
+ ind=( {1..${#${(P)${compstate[parameter]}}}} )
+ list=()
+ for i in "$ind[@]"; do
+ [[ "$i" = ${PREFIX}*${SUFFIX} ]] &&
+ list=( "$list[@]" "${(r:4:: ::):)i} ${(P)${compstate[parameter]}[$i]}" )
+ done
+
+ if [[ "$RBUFFER" = \]* ]]; then
+ compadd -S '' -y list - "$ind[@]"
+ else
+ compadd -S ']' -y list - "$ind[@]"
fi
else
_compalso -math-
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~1999-06-18 10:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-06-18 10:01 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-01-14 16:58 PATCH: new completions Oliver Kiddle
2004-01-15 7:33 ` Bart Schaefer
2004-01-15 9:41 ` Oliver Kiddle
1999-06-18 12:49 PATCH: New completions Kiddle, Oliver
1999-06-18 13:04 ` Falk Hueffner
1999-06-18 13:31 ` Tanaka Akira
1999-06-18 13:27 ` Tanaka Akira
1999-06-18 10:36 Sven Wischnowsky
1999-06-18 9:30 Kiddle, Oliver
1999-06-18 12:06 ` Tanaka Akira
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199906181001.MAA13055@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).