Can I specify what characters set the double-click selection boundary in GNOME Terminal?

When I double-click to select text in GNOME Terminal, the selection stops at spaces but continues over hyphens:

spaces

hyphens

Some of my filenames contain uncommon characters such as the heavy teardrop-spoked asterisk and are not selectable by double-clicking:

unusual characters

Is there a way to make double-click selection continue over these characters as well?


Solution 1:

[Adding an answer since the accepted one no longer works.]

Script

I put this together into a script to set the word separators:

https://github.com/ab/ubuntu-wart-removal/blob/master/gnome-terminal-word-separators.sh

Background

GNOME Terminal has flip flopped several times on this subject.

This configuration feature was removed in gnome-terminal 3.14 (included in Ubuntu 15.04 Vivid)

  • https://bugzilla.gnome.org/show_bug.cgi?id=727743
  • https://bugzilla.gnome.org/show_bug.cgi?id=730632

Then in gnome-terminal 3.16 (included in Ubuntu 15.10 Wily), the option was reintroduced under the hood, but with no UI. In addition, colon : was changed to be treated as a word separator.

Editing with dconf

Per these instructions, you can configure the set using dconf: https://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/1401207/comments/8

I like to use -#%&+,./:=?@_~ as the set of non-word-separators.

Note that the use of colons there is /crazy/. Yes, there is :/: in there.

1) edit -> profile preferences -> the General tab on your profile has its Profile ID, e.g. b1dcc9dd-5262-4d8d-a863-c897e6d979b9

2) check you've got the syntax right with:

$ dconf list /org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/ foreground-color visible-name palette use-system-font ...

If it returns nothing, you've got it wrong; try again.

3) dconf write /org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/word-char-exceptions '@ms "-#%&+,./:=?@_~"'

Specifically, this has ":" in, which makes it select URLs like I expect. (http://example.com doesn't select "//example.com").

Solution 2:

In "Edit > Profile Preferences > General", add the character to the "Select-by-word characters" box.