On Mon, Apr 16, 2007 at 05:50:07PM +0200, Andy Spiegl wrote:
> Hi Giulio,
>
> > to put the output of a program in the shell killring, something like
> >
> > myprogram | copythis
>
> This example sounds more interesting. Actually, this reminds me of a
> zsh-feature that I am missing sometimes: execute the command at the prompt
> and replace it with its result. Something like this:
>
> condor:~>zcalc 170000. /7
> [some magic key..]
> condor:~>24285.714285714286
> [ctrl-A zcalc ...]
> condor:~>zcalc 24285.714285714286 % 7
> [some magic key..]
> condor:~>2
> [and so on...]
>
> Any ideas?
> That would make your copy_this superflous, too. (c;
[...]
edit-command-output() {
BUFFER=$(eval $BUFFER)
CURSOR=0
}
zle -N edit-command-output
bindkey '\e!' edit-command-output
$ echo foo<Meta-!>
$ foo
Or maybe:
edit-command-output() {
local output
output=$(eval $BUFFER) || return
BUFFER=$output
CURSOR=0
}
--
Stéphane