Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [zsh] Re: retrieving the results of last command?



» On Fri, May 20, 2005 at 01:54PM +0100, Peter Stephenson wrote:

> You can simplify retrieving the command by using the parameter history
> from the zsh/parameter library, which contains the history indexed
> by the history line number, and the standard parameter HISTCMD which
> gives the current history line number.
>
> Normal "insert" widgets append stuff to the left of the cursor
> rather than replacing RBUFFER.
>
> You whould be able to do this:
>
> zmodload -i zsh/parameter
> insert-last-command-output() {
>   LBUFFER+="$(eval $history[$((HISTCMD-1))])"
> }

Thanks a lot for the corrections and explantion!

Cheers,
Francisco.



Messages sorted by: Reverse Date, Date, Thread, Author