Rebinding copy & paste in urxvt

3.8k Views Asked by At

rxvt-unicode has the ability to copy to/from system clipboard using Ctrl+Meta+C and Ctrl+Meta+V (Meta is Alt usually).

Is there a way to rebind those functions to other keys? Ctrl+Shift+C and Ctrk+Shift+V would be more intuitive choice.

2

There are 2 best solutions below

1
Alex Griffin On

I just managed to get this working yesterday. Here are the X resources I needed:

! Disable ISO 14755 unicode input so we can use Ctrl-Shift bindings
URxvt.iso14755:        false
URxvt.iso14755_52:     false

! Disable Ctrl-Alt-c & Ctrl-Alt-v bindings (optional)
URxvt.keysym.C-M-c:    builtin-string:
URxvt.keysym.C-M-v:    builtin-string:

! Bind Ctrl-Shift-c & Ctrl-Shift-v to copy and paste
! I dont know why, but I needed to use hex keysym values to get it to work
URxvt.keysym.C-S-0x43: eval:selection_to_clipboard
URxvt.keysym.C-S-0x56: eval:paste_clipboard
1
will On

Changing the last two lines as follows changes ctrl-shift-c/v to ctrl-c/v. Change:

URxvt.keysym.C-S-0x43: eval:selection_to_clipboard
URxvt.keysym.C-S-0x56: eval:paste_clipboard

To:

URxvt.keysym.C-0x63: eval:selection_to_clipboard
URxvt.keysym.C-0x76: eval:paste_clipboard