Modernizing XTerm’s Paste

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)

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.

CC BY-SA 4.0 Modernizing XTerm’s Paste by Stephan Sokolow is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

This entry was posted in Geek Stuff. Bookmark the permalink.

5 Responses to Modernizing XTerm’s Paste

  1. 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!

  2. Jimmy says:

    This is really nice! Forever included in my .Xresources file, so I don’t have to middle click all the time.

  3. Marcker says:

    Thanks for post.

  4. 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 with page. It’s all documented in man xterm)

Leave a Reply to Jimmy Cancel reply

Your email address will not be published. Required fields are marked *

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution under the same terms as the associated post.

All comments are moderated. If your comment is generic enough to apply to any post, it will be assumed to be spam. Borderline comments will have their URL field erased before being approved.