我可以在GNOME终端中指定哪些字符设置双击选择边界?

当我双击以在GNOME终端中选择文本时,选择在空格处停止但在连字符上继续:

空间

连字符。

我的一些文件名包含不常见的字符,例如沉重的泪珠状星号 ,双击时无法选择:

不寻常的人物

有没有办法让双击选择继续这些字符?

在“编辑>配置文件首选项>常规”中,将字符添加到“按字选择字符”框中。

[添加答案,因为已接受的答案不再有效。]

脚本

我把它放在一个脚本中来设置单词分隔符:

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

背景

GNOME终端在这个问题上多次翻转。

此配置function已在gnome-terminal 3.14中删除(包含在Ubuntu 15.04 Vivid中)

然后在gnome-terminal 3.16(包含在Ubuntu 15.10 Wily中)中,该选项在引擎盖下重新引入,但没有UI。 另外,冒号:被改为被视为单词分隔符。

使用dconf进行编辑

根据这些说明,您可以使用dconf配置集: https ://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/1401207/comments/8

我喜欢使用-#%&+,./:=?@_~作为一组非字分隔符。

注意冒号的使用是/ crazy /。 是的,有:/:在那里。

1)编辑 – >个人资料首选项 – >个人资料中的“常规”标签有其个人资料ID,例如b1dcc9dd-5262-4d8d-a863-c897e6d979b9

2)检查你的语法是否正确:

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

如果没有任何回报,你就错了; 再试一次。

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

具体来说,它有“:”,这使得它选择像我期望的URL。 ( http://example.com不选择“//example.com”)。

在其他终端中实现的一个非常有用的默认function是逐行选择屏幕上一条线的扩展部分。 例如,给定

 /home/username/dir1_r.2-3/dsr.filenr_34.ctr 23456677 dftrprpr 

双击,例如, filenr中的dsr.filenr_34.ctr将从filenr进展到:

  filenr_34 dsr.filenr_34.ctr -3/dsr.filenr_34.ctr 2-3/dsr.filenr_34.ctr r.2-3/dsr.filenr_34.ctr dir1_r.2-3/dsr.filenr_34.ctr username/dir1_r.2-3/dsr.filenr_34.ctr home/username/dir1_r.2-3/dsr.filenr_34.ctr home/username/dir1_r.2-3/dsr.filenr_34.ctr 23456677 home/username/dir1_r.2-3/dsr.filenr_34.ctr 23456677 dftrprpr /home/username/dir1_r.2-3/dsr.filenr_34.ctr 23456677 dftrprpr 

可以通过添加对来直到下一级分隔符来解决周围的对称性。

当然,用户应该可以选择更改默认值。

其他答案今天不起作用…这适用于ubuntu 18.04 …首先确定你的UUID gnome终端配置文件ID …在终端发出此信息

 profile=$(gsettings get org.gnome.Terminal.ProfilesList default) echo $profile # for me it gives b1dcc9dd-5262-4d8d-a863-c897e6d97969 

现在改变:

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

直到ubuntu 18.04得到修复后,以下读命令默默地失败,而它在ubuntu 16.04上工作正常

 dconf read /org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/word-char-exceptions 

扩展@alberge答案,您可以执行以下python3脚本来更改所有配置文件来执行此操作:

 #!/usr/bin/python3 import subprocess command = ["dconf", "list", "/org/gnome/terminal/legacy/profiles:/"] result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) profiles = result.stdout.split('\n') for profileString in profiles: if profileString.startswith(":"): changeCmdPart = "/org/gnome/terminal/legacy/profiles:/" + profileString + "word-char-exceptions" changeCmd = ["dconf", "write", changeCmdPart, '@ms "-#%&+,./:=?@_~"'] subprocess.run(changeCmd) print("done!") 

或者你可以执行:

 curl -s http://scripts.programster.org/scripts/5?output=raw | python3