You do it with X resources. I have a file, .Xresources
, that contains these xterm-related resources:
XTerm*VT100.cutNewLine: false
XTerm*VT100.cutToBeginningOfLine: false
XTerm*VT100.charClass: 33:48,35:48,37:48,42:48,45-47:48,64:48,95:48,126:48
In my .xinitrc
file, I have some line that merge in those resources:
if [ -f $userresources ]; then
/usr/X11/bin/xrdb -merge $userresources
fi
Those lines make xterm double-clicks and triple-clicks do what I like:
Double-click considers a "word" to include slash (/), dot (.), asterisk (*) and some other non-alphanumeric characters. That's the "charClass" resource. I had to do some tedious fiddling with that charClass to get it to do what I want. That mostly lets you double-click on URLs and fully- or partially-qualified paths to highlight them.
The other two lines make triple-click start from the word under the mouse, and go to the end of the line, but not include any new-line. That way, you can triple click on a command you just executed, paste it in another window, and because it has no new-line, you can edit it before running it in the other window.
The Arch Wiki has an article on X resources, including a section on xterm resources, but those xterm resources aren't complete.
XTerm*VT100.charClass: 0-32:0,33-65535:1
. Double-click will then consider a "word" to be any sequence of symbols excluding whitespace (and control characters). – Newtonx Feb 28 '18 at 05:04cutNewLine
->cutNewline
. Maybe that was introduced in newer versions. – x-yuri Aug 18 '18 at 17:51onNClicks: regex
seems at least more readable. – x-yuri Aug 18 '18 at 18:03