by skywal_l · 5y ago · 0 comments
The submission is not equivalent but clearly can help avoid having to move your mouse around. Still wish I didn't have to modify the original command as, very often, I realize that I want to copy the command's output after I execute it.
It is never too late to steal features that the Commodore 64 could do in the early 80s (!!!).
oh, Extraterm can help you reuse previous output after the fact and without having to be clairvoyant.
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...