In my .zshrc
, I use the following snippet to integrate the shell's clipboard and my primary X11 clipboard. Thanks to this integration, I can cut-and-paste text to and from emacs, firefox, and the terminal without having to use the mouse.
kill-line() { zle .kill-line ; echo -n $CUTBUFFER | xclip -i }
zle -N kill-line # bound on C-k
yank() { LBUFFER=$LBUFFER$(xclip -o) }
zle -N yank # bound on C-y
Note: I use this trick on mac os x as well (with pbcopy/pbpaste instead of xclip) and thanks to Synergy my two computers share a single clipboard. Neat. But it doesn't work with readline. And I find myself using readline quite often, for example in (i)python, in gdb, in ncftp...
So here comes my question: is there a way to integrate readline's clipboard with the-rest-of-the-world ?
Of course, I'm thinkging about some .inputrc
wizardry here, but any insight/ideas would be welcome.