Hacker News new | ask | show | jobs
by IronBacon 1907 days ago
> I realize that I want to copy the command's output after I execute it.

With Zsh, cheating a little, you can achieve it with:

    _insert-last-command-output () {
        LBUFFER+="$(LS_COLORS= TERM=vt220 eval $history[$((HISTCMD-1))])"
    }
There's some junk used for my configuration, the relevant part is the "eval" of the last command on the history, it doesn't paste the output of the previous command but it's execute d again, this time with the output going straight in the edit buffer. I use it to manipulate the output of the previous command on the shell — it works better if the output is a single line — but I think it could be modified to put the output also on the clipboard...