Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Tip of the day: previous command output
- X-seq: zsh-users 7899
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Tip of the day: previous command output
- Date: Fri, 20 Aug 2004 22:58:07 -0700 (PDT)
- In-reply-to: <Pine.LNX.4.61.0408200905300.27591@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20040819085812.GL22962@localhost> <Pine.LNX.4.61.0408190748530.9464@xxxxxxxxxxxxxxxxxx> <20040819164250.GA21575@xxxxxxxxx> <Pine.LNX.4.61.0408190956440.9464@xxxxxxxxxxxxxxxxxx> <20040820121202.GA31466@xxxxxxxxx> <20040820145032.GH13530@xxxxxxxxxxxxx> <Pine.LNX.4.61.0408200905300.27591@xxxxxxxxxxxxxxxxxx>
- Reply-to: zsh-users@xxxxxxxxxx
On Fri, 20 Aug 2004, Bart Schaefer wrote:
> I won't try to test this, but something like this should do it:
OK, I lied. I tested it. It didn't do what I expected, though it did
what I told it to do.
Here's a version that actually does what was asked:
_expand_word_and_keep() {
function compadd() {
local -A args
zparseopts -E -A args J:
if [[ $args[-J] == all-expansions ]]
then
builtin compadd -A kept "$@"
kept=(${(Q)${(z)kept}})
fi
builtin compadd "$@"
}
local result
_main_complete _expand
result=$?
unfunction compadd
return result
}
With 4.2.1, you can replace the five "local ... return" lines with
{ _main_complete _expand } always { unfunction compadd }
Left as an excercise: Get the name of the "keep" variable from a zstyle,
so you can stash expansions in different places depending on context.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author