Every modern terminal emulator supports ANSI OSC-52 out-of-the-box. xterm is not one of those1.

OSC-52 allows one to copy text into the system clipboard. It’s a very handy escape sequence to be used alongside terminal emulators and terminal multiplexers such as tmux/screen.

It’s also possible to enable OSC-52 in vim, making copy-and-paste a first-class citizen therein.

As mentioned in the intro, most modern applications already support it out-of-the-box, as such there’s no need to configure them. We would like to configure xterm as well though, because it is widely available in pretty much every Unix out there.

$ grep -B 1 -i allowWindowOps ~/.Xresources
! osc-52 support
*.allowWindowOps: true

Then apply:

$ xrdb -merge ~/.Xresources

All new xterm applications should then pick up the new resource.


  1. maybe because it’s not modern, and it’s not decent? ;) ↩︎