I know a lot of people prefer *term or *onsole to xterm, but I'm a pretty die-hard xterm user. A while ago I noticed that an Ubuntu system I was using had the double-click to select text acting slightly differently than I was used to. I dug a little deeper and found that you could specify a "charClass" setting to group characters that would be considered similar and grouped when you double-clicked to select a word. Last week I found an even cooler option...
xterm has resources for "on2Clicks" through "on5Clicks". These can be set to various values, one of which is "regex". That's right, you can use a regex to determine what sorts of things are matched, for more and more clicks.
I'm running pretty simple values of:
xterm*on2Clicks: regex [^/@ \n]+ xterm*on3Clicks: regex [^ \n]+ xterm*on4Clicks: regex [^#$]+ xterm*on5Clicks: line
In other words, a double click will allow me to select the last component of a path, the local or domain part of an e-mail address, or a simple word. 3 clicks will get anything up separated by white-space, and 4 clicks will get everything up to my prompt, including tailing newline. 4 is one I'm really looking forward to. Finally, 5 clicks will snag the whole line.
If you want to do this, you need to put the above into your ~/.Xdefaults file and get X to pick up the changes. Probably easiest is to log out and back in. You can write these lines to a file and do "xrdb -merge <filename", then start up a new xterm and try it out. It will not impact the currently running xterms (they've already loaded their resources).comments powered by Disqus