DIY & Music & Guitar & Beer & Tech

Windows Terminal Setup

I was eagerly waiting for Microsoft to release this Terminal and the wait has paid off. I love it. While still not completely plug’n’play for all the features that I wish for it is nearly there and definitely more than ready to take throne of the no. 1 Terminal in Windows. I’ll describe some of my tweaks and settings. I came from ConEmu+GitBash setup that started to act out lately – what really got on my nervs is reseting terminal width when in ssh-session to 80 columns after editing in ‘nano’. Another thing was arrows stopped working in ‘vim’. It started to become pain. WT to the rescue.

First of all there are two version out there, Standard and Preview. As the name suggests, preview is more like latest and greatest and standard install is more stable. However I opted for preview as it comes with some features enabled that I needed from the start. they do suggest that it might not update automatically as standard would but if you maintain your machine manually and in more controlled fashion this is not an issue.

First thing is to add a profile for Git Bash. This is done from settings in WT (shortcut: ctrl + ,). Alternatively edit the ‘settings.json’ file directly. My final profile looks like this:


{
    "colorScheme": "Arthur",
    "commandline": "C:\\Program Files\\Git\\bin\\bash.exe -l -i",
    "guid": "{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}",
    "historySize": 99999,
    "icon": "C:\\Program Files\\Git\\mingw64\\share\\git\\git-for-windows.ico",
    "name": "GitBash",
    "opacity": 100,
    "startingDirectory": "C:\\git",
    "suppressApplicationTitle": false,
    "unfocusedAppearance": {},
    "useAcrylic": true
}

Few comments on above:
– in ‘commandline’ we want to use bash.exe from bin folder and not the git-bash one from parent folder. Reason is that bash.exe is the light version with only shell, no unnecessary embedded features such as running git and such as these probably already exist on the machine anyway. Less memory footprint and faster. ‘-l -i’ are login and interactive options for starting bash.
– ‘colorsheme’ is scheme I added and I’ll post it here as well.
– history size by default is ~9k I simply increase this as an old habit
– suppressApplicationTitle – use false if you want the tab title to be update from bash (e.g. name@host: pwd)
– rest is self-explanatory and/or simple appearance settings – note that bit bash is not always installed in ProgramFiles, adjust paths accordingly

Second thing is to add a file named ‘git-bash.config’ in ../Git/etc with folowing content:


export MSYS=enable_pcon
MSYS=enable_pcon winsymlinks:nativestrict

Above is fix for arrows in Vim/Less etc. until this bug is fixed.

Color scheme above (you can paste it directly among other ones):


{
    "background": "#1C1C1C",
    "black": "#3D352A",
    "blue": "#6495ED",
    "brightBlack": "#554444",
    "brightBlue": "#87CEEB",
    "brightCyan": "#B0C4DE",
    "brightGreen": "#88AA22",
    "brightPurple": "#996600",
    "brightRed": "#CC5533",
    "brightWhite": "#DDCCBB",
    "brightYellow": "#FFA75D",
    "cursorColor": "#E2BBEF",
    "cyan": "#B0C4DE",
    "foreground": "#DDEEDD",
    "green": "#86AF80",
    "name": "Arthur",
    "purple": "#DEB887",
    "red": "#CD5C5C",
    "selectionBackground": "#4D4D4D",
    "white": "#BBAA99",
    "yellow": "#E8AE5B"
}

Three quick settings that are a must (for me) are:


"copyFormatting": "none",
"copyOnSelect": true,
"firstWindowPreference": "persistedWindowLayout",

Do not copy any format just plain text and copy automatically when selecting text. Last one will open any layout and tabs that were closed in the last session. WT will (with some messing around) remember path in some consoles but not in git bash. I solve this ‘problem’ with custom profiles that open prefered console with prefered layout, icon, title and path. These profiles are really useful and expand on the idea of having a simple ‘+’ for new tab. This is an example of 4×4 grid split-pane with custom paths. Note that even inside this custom profile you can (and probably should) use other custom profiles. I create such profiles and make them ‘hidden’ thus not cluttering my ‘+’ menu. In these custom hidden profiles we can specify in more detail things that we do not wish as default for every console of that ‘type’.

First, generic, simple one with defaults:


{
                "commandline": "wt -w 0 new-tab ; split-pane -V ; move-focus left ; split-pane -H ; move-focus up ; move-focus right ; split-pane -H",
                "guid": "{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}",
                "hidden": false,
                "name": "4x4"
            }

Here is more comprehensive example with 3 split panes and other custom stuff:


{
                "commandline": "wt -w 0 new-tab -p "CustomGitBash" -d "C:\\git\\customer-project1" ; split-pane -H --suppressApplicationTitle -p "CustomGitBash" -d "C:\\git\\some-other-project" ; move-focus down ; split-pane -V --suppressApplicationTitle -p "CustomGitBash" -d "C:\\git\\super-cool-project3"",
                "guid": "{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}",
                "hidden": false,
                "icon": "C:\\some-folder\\custom-icon.png",
                "name": "Custom tab with 3 panes"
            }

These configuration options are really powerful and one can create fast templates for whatever task needed. Possibly my favorite thing with WT. One of the default profiles made custom might look like (only rows that diff are here):


{
   "hidden": true,
   "icon": "C:\\some-folder\\some-other-custom-icon.png",
   "name": "Custom Git Bash",
   "suppressApplicationTitle": true,
   "tabTitle": "Custom title"
}

Default Git-Bash profile might not differ much but that does not matter – you can configure it as you wish – in this case I want to use it as a part of another profile hence hidden:true; suppressApplicationTitle allows for custom title and icon, name and title are also changed.

Not really WT dependent/related but I also like the WSL (Windows Subsystem for Linux) and I do have it as one of the profiles. Currently I have Ubuntu 20.04 installed and profile looks like this:


{
    "guid": "{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}",
    "hidden": false,
    "name": "Ubuntu-20.04",
    "source": "Windows.Terminal.Wsl",
    "startingDirectory": "~"
}

If you have not had a chance to try it out I suggest you do, here is a good starting point: WSL install instructions.

There are a lot of available themes and this site is a good resource for that.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.