Chad Perrin: SOB

2 February 2010

How I Use XTerm

Filed under: Geek — apotheon @ 05:14

I thought I had already posted something about this to SOB, but I just realized that I had only talked about it on a mailing list.

Basically . . . one of the things I dislike about XTerm is the way it handles multi-click text highlighting by default. Another is the fact that it doesn’t do Unicode by default. Of course, XTerm does everything, one way or another — or so it seems. It just takes working around the defaults somehow.

To solve the Unicode problem, just set the “UXTerm” X resource, which includes applying the effects of XTerm’s -class and -u8 options. On at least most systems, entering the command uxterm (instead of xerm) should do the trick there. It seems that someone somewhere along the way came up with the brilliant idea of providing a standard UXTerm resource-active wrapper for XTerm.

To solve the multi-click highlighting problem, your XTerm app-defaults file (on FreeBSD, that’d be /usr/local/lib/X11/app-defaults/XTerm) can be edited to include some lines to specify exactly what characters are considered valid highlighting characters for a given number of clicks. Anything up to five clicks can be defined this way.

There are specific terms with specific meanings that can be used here, and the default for two clicks is XTerm’s concept of a “word” — which is fine by me. The defaults for three through five clicks, however, don’t work so well for me. In fact, by default, three clicks will match a “line”, and both four and five clicks have no default at all. Other than “word” and “line”, though, none of the options (which are listed in the XTerm manpage under the on5Clicks resource) match any of the things I’d really like to see highlighted on a given number of clicks. Luckily, the XTerm app-defaults file also supports a (limited) regex syntax for the onNClicks resources, where N is the number of clicks.

Keeping the on2Clicks default, the configuration I use to customize multi-click highlighting is:

xterm*on3Clicks:  regex [^ \n]+
xterm*on4Clicks:  regex .*
xterm*on5Clicks:  line

So. That’s the long and the short of it. Other than that, all I use that isn’t an XTerm default on my FreeBSD systems is a pair of options — specifically, the -r and -sb options (for “reverse video” and “scroll bar”, respectively).

addenda:

If you wish these changes to apply only to UXTerm on FreeBSD, the appropriate file to edit is /usr/local/lib/X11/app-defaults/UXTerm. The proper location for this file may vary among Linux distributions.

All original content Copyright Chad Perrin: Distributed under the terms of the Open Works License