OpenBSD / Copy And Paste In Xterm

Xterm is bloated and archaic terminal emulator, but it ships with OpenBSD and gets the job done, so I'm happily using it.

Browsing through the 6206 line long manual I found an excellent snippet which I thought others might find useful.

Not everyone finds the three-button mouse bindings easy to use. In a wheel mouse, the middle button might be the wheel. As an alternative, you could add a binding shifted keys:

*VT100*translations:      #override \n\
    Shift Home:     copy-selection(SELECT) \n\
    Shift Insert:   copy-selection(SELECT) \n\
    Ctrl Shift C:   copy-selection(SELECT) \n\
    Ctrl Shift V:   insert-selection(SELECT)

You would still use the left- and right-mouse buttons (typically 1 and 3) for beginning and extending selections.

Switching this up slightly to use the CLIPBOARD buffer gives us:

xterm*VT100.Translations: #override \n\
    Ctrl Shift C:    copy-selection(CLIPBOARD) \n\
    Ctrl Shift V:    insert-selection(CLIPBOARD)

Add this to your ~/.Xdefaults and reload the configuration with xrdb -merge ~/.Xdefaults.

Now you can copy and paste from xterm using Ctrl-Shift-C and Ctrl-Shift-V respectively!

Last updated on .