If you’ve ever tried to alter XTerm’s key/mouse bindings, you’ve probably noticed that the documentation is cryptic, pretty much only found in the manpage, and not supplemented by anything you’re likely to find on Google.
So, one day, when I decided I wanted yeahconsole to have some keybindings more similar to the modern ones I’d grown familiar with from Yakuake, I was in for quite a fight.
Here’s what I came up with should anyone else want them. (Sorry I couldn’t implement the Ctrl+Shift+X/C part too. I’m starting to doubt it’s actually possible without patching XTerm’s source)
If you want to modify or extend this, here’s a complete list of the resources I found useful in helping me to understand the darn thing: (Ordered roughly from most to least likely to help you)
Documentation
- Examples
- Reading the config files in
/usr/share/X11/app-defaults/
(May be at/etc/X11/app-defaults/
or/usr/lib/X11/app-defaults/
depending on your distro) - http://www.jmknoble.net/old-stuff/add-to-.Xdefaults.txt
- Reading the config files in
- Discussion Archives
- sunmanagers.org – xterm keymap() in .Xdefaults
- SOFT32.com – ISO: efficient way to set xterm keyboard translations
- FixUnix – shortcut key problem in Xterm – X
- FixUnix – xterm insert-selection(PRIMARY,CUT_BUFFER0) – Xwindows
- FixUnix – xterm insert-selection(PRIMARY,CUT_BUFFER0)string(0x0D) – Xwindows
- groupsrv.com – Linux X – shortcut key problem in Xterm
- freebsd-questions – changing keyboard behaviour
- StackOverflow – copy and paste from terminal with keyboard in linux (ubuntu)
If, while customizing, you find a better reference for the valid function mappings for Translations or if you figure out a way to implement Ctrl+Shift+X/C/V for cut/copy/paste, please let me know.
Update: If you insist on Ctrl+V pasting, urxvt is equivalent to xterm in every way you’re likely to care about and there’s a clipboard Perl extension for it.
Modernizing XTerm’s Paste by Stephan Sokolow is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Thank you for this post. I spent over an hour trying to come up with a similar solution before I stumbled on your config settings. Works great!
This is really nice! Forever included in my .Xresources file, so I don’t have to middle click all the time.
Thanks for post.
Wow, thanks for bringing xterm into the 21st century. Those are helpful. But the Shift-PgUp/PgDown one doesn’t work for me. It just displays a ‘~’. Any idea why?
The tilde generally indicates that you’ve got nothing bound to that key combo and the shell tried to interpret the escape code is generates. Shift+PgUp/PgDown are supposed to be built-in bindings and I didn’t override them so I assume something about your system doesn’t define them.
Try adding these lines to your
VT100.Translations
map:Shift <Key>Prior: scroll-back(1, halfpage) \n\
Shift <Key>Next: scroll-forw(1, halfpage) \n\
(That’ll match the behaviour I have. If you truly want to go page-by-page, just replace
halfpage
withpage
. It’s all documented inman xterm
)