22

I'm trying to setup the new Windows Terminal for using git-bash. This is my current profile:

{
    "guid": "{00000000-0000-0000-ba54-000000000002}",
    "tabTitle": "Git Bash",
    "copyOnSelect": true,
    "acrylicOpacity" : 0.75,
    "closeOnExit" : true,
    "colorScheme" : "Campbell",
    "commandline" : "\"%PROGRAMFILES%\\git\\bin\\bash.exe\" --login -i -l",
    "cursorColor" : "#FFFFFF",
    "cursorShape" : "bar",
    "fontFace" : "Consolas",
    "fontSize" : 12,
    "historySize" : 9001,           
    "name" : "Git Bash",
    "padding" : "0, 0, 0, 0",
    "snapOnInput" : true,
    "startingDirectory" : "C:\\git",
    "useAcrylic" : false,
    "wordDelimiters": ":",
    "icon" : "%PROGRAMFILES%\\git\\mingw64\\share\\git\\git-for-windows.ico"

A bit of a show stopper for using the Windows Terminal is the fact that when selecting text using double-click it only selects one word, instead of a more intelligent selection (like a complete path).

I've tried using the setting "wordDelimiters:" with setting like:

`wordDelimiters: ":"` 

or

`wordDelimiters: "()'-:,.;<>~!@#$%^&*|+=[]{}~?"`

but it doesn't seem to have any affect on what text is selected on double-click.

Expected behaviour when I double-click on 'my' is that it select the whole path (file name included). Instead it just selects 'my'. Path/to/my/file.txt

Does anyone know how get this to work, like it does in native git-bash?

torsan
  • 401
  • 5
  • 14
  • 3
    Just to clarify. Put `"wordDelimiters": "()\"':,;<>!@#$%^&*|+=[]{}?│"` directly, not add with \` at the beginning and end. Also, the Escape character should be used as there is a `"` already. https://learn.microsoft.com/en-us/windows/terminal/customize-settings/global-settings – Zhilong Jia Jan 14 '21 at 13:05

1 Answers1

40

Put the wordDelimiters setting in the global section of your settings.json file, not within the "profiles" array. I finally figured this out by looking at the documentation link at the top of the file, it is probably a good place to look when trying to add new settings.

// For documentation on these settings, see: https://aka.ms/terminal-documentation

enter image description here

JohnD
  • 14,327
  • 4
  • 40
  • 53
  • 1
    The docs refer to "profiles.json", but upon selecting Settings from the Microsoft Terminal dropdown, it file is actually "settings.json". – Bill Hoag Jun 11 '20 at 20:12
  • Thanks Bill, looks like they renamed the file so I'll update the answer – JohnD Jun 12 '20 at 13:39
  • 2
    The exact page for the documentation of `wordDelimiters` would be [here](https://learn.microsoft.com/en-us/windows/terminal/customize-settings/interaction#word-delimiters). The top of that page explicitely says: "The properties listed below affect the entire terminal window, regardless of the profile settings. These should be placed at the root of your settings.json file." – philb Aug 27 '21 at 12:12
  • 4
    One can access `settings.json` quickly by holding Shift and clicking "Settings" from the dropdown menu in Windows Terminal. – Paek Se Sep 23 '21 at 00:15
  • This works, but unfortunately the selection doesn't wrap to the next line when you double click: https://github.com/microsoft/terminal/issues/6178 – Samuel Sep 12 '22 at 21:16