5

I am running ubuntu 12.04.5 lts. When I do a mouse double click selection I would like to select only a current word. For example in a line like:

/home/xx/asdf

right now the whole line gets selected when I doulble click on "xx". Also in a line like:

 $asdf=

I would like to select the 1st five characters - include $ in the selection. Right now it selects asdf= - 5 characters including the equal sign.

UPDATE: The answer I accepted no longer works since Ubuntu 15 it seems. The following answer works in Ubuntu18:

Double click selection in Gnome Terminal

0

3 Answers 3

4

For gnome-terminal:

In the menu bar, under Edit : Profile Preferences, tab General you will find Select-by-word chatacters. If you want the terminal to consider / to be a word boundary for selection purposes, remove / from the list of characters.

4
3

In some cases gnome-terminal preferences doesn't have the select-by-word characters option. It still has the profile-ID you need for command-line configuration though: Obtain it in the edit -> profile preferences -> General tab on your profile.

use

dconf list /org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/

to check whether it works. If no output, then the profile-id is not b1dcc9dd-5262-4d8d-a863-c897e6d979b9, copy pate the one from the preferences as descibed above.

then use:

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

with the correct profile-ID. Here I remove / and = from the list but add $ according to the OP's wish.

Note that you can still select a word which is split by this character, say iceweasel/stable : double-click on the first part, then hold the shift key and click on the second part.

1
  • "anymore" is a bit ambiguous. The select-by-word characters option is still there in Gnome Terminal 2.31.3, which is on a RHEL 6.5 (Santiago) system running Gnome 2.28.2. Additionally, dconf isn't on the system.
    – Randall
    Nov 13, 2015 at 19:05
0

The dconf approach no longer seems to work on ubuntu20 and maybe others. This worked for me:

UUID=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ word-char-exceptions '@ms "-/@_&.?"'   

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .