2
votes

I am trying to create custom keybindings in Xterm that will allow me to copy and paste text from/to the X11 clipboard. I am currently able to paste from the clipboard using the default Shift + Insert (after adding XTerm*selectToClipboard: true in my ~/.Xresources file) but this is awkward on my keyboard and I would like something else. My terminal has Vi keybindings and I would like to bind p in command mode to paste and y to yank/copy. I tried adding this to ~/.Xresources and reloading with xrdb -merge ~/.Xresources:

!! New copy, paste
XTerm*VT100*translations: #override \n\
    p:  insert-selection(CLIPBOARD) \n\
    y:        select-end(CLIPBOARD)

... but it doesn't work. Any ideas how I can fix this?

1

1 Answers

4
votes

You probably meant something like this:

XTerm*selectToClipboard: true
XTerm*VT100*translations: #override \n\
    Ctrl Shift <Key>P:  insert-selection(CLIPBOARD) \n\
    Ctrl Shift <Key>Y:        select-end(CLIPBOARD)

I added modifiers to limit the scope of the translation to avoid having every P and Y trigger the actions and the <Key> marker to explain to the library what P and Y are.