I often find myself wanting to exchange some text object with whatever's currently in CLIPBOARD (not necessarily in Emacs' kill-ring, when I copy from other programs). But of course when I do something like dib
, it puts what I removed in the CLIPBOARD, overwriting what was in CLIPBOARD (since I didn't first paste it into Emacs), so I can't just P M-y
. So I have to copy it again, next time carefully doing PudibP M-y
.
This feels inefficient. Is there a built-in way in emacs/evil to, instead of deleting, exchanging what I'm removing with what's in CLIPBOARD/top-of-kill-ring?
C-p
orC-n
in normal state after pasting the text?cheese
from a different program (socheese
is in CLIPBOARD but not kill-ring), and point is within(cake)
and I dodibP^P
, thedib
will putcake
in kill-ring & CLIPBOARD, overwritingcheese
in the CLIPBOARD, while^P
will move back to whatever I last copied inside Emacs.(setq save-interprogram-paste-before-kill t)
.