Windows Terminal Setup

So after inadvertently wiping out my Windows Terminal setup this past week I thought this would be a good candidate for my next post (and also a good record for myself!).

I’ve been using Windows Terminal for a while now and followed its development while it was in beta. Before this I was using the excellent ConEmu but after seeing Microsoft was finally going to update it’s terminal offering I thought I’d make the swap.

Screenshot of Powershell tab displaying current profile settings

Here is my current profile settings:

"profiles":
    {
        "defaults":
        {
            "fontFace": "FiraCode NF",
            "hidden": false,
            "useAcrylic": false,
            "cursorColor": "#ffffff",
            "cursorShape": "vintage",
            "fontSize": 10
        },
        "list":
        [
            {
                // Make changes here to the powershell.exe profile.
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "name": "Windows PowerShell",
                "commandline": "powershell.exe",
                "colorScheme": "Campbell Powershell",
                "backgroundImageAlignment": "bottomRight",
                "backgroundImageStretchMode": "none",
                "backgroundImage": "c:\\gifs\\StormTrooperSmall.png",
                "startingDirectory": "c:\\git",
                "tabTitle": "Windows Powershell"
            },
            {
                // Make changes here to the cmd.exe profile.
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "name": "Command Prompt",
                "commandline": "cmd.exe"                                
            },
            {
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell",
                "source": "Windows.Terminal.PowershellCore",
                "colorScheme": "Campbell",                
                "backgroundImageAlignment": "bottomRight",
                "backgroundImageStretchMode": "none",
                "backgroundImage": "c:\\gifs\\smalldinosaur.png",
                "startingDirectory": "c:\\git"
            },
            {
                "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
                "hidden": false,
                "name": "Ubuntu-18.04",
                "source": "Windows.Terminal.Wsl"
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            }
        ]
    }

To get things setup the way I want I’ve installed a few utilities. The first one is PoshGit which gives me a quick Git status summary (like the branch I’m currently on, if there are any files that have changed, how out of sync I am with the branch I’ve based my branch off etc.).

The next PowerShell module I’ve installed is oh-my-posh, which provides a way of theming the prompt, this isn’t configured through the Windows Terminal setup file but rather though my default PowerShell profile. (To get to this type $profile in a PowerShell prompt, this will display the full path, copy that and open it in your favourite text editor).

Here’s the section of my PowerShell profile that imports the oh-my-posh module and sets the theme to Agnoster (There are loads of themes, this one just suits me the best)

Import-Module 'C:\tools\poshgit\dahlbyk-posh-git-9bda399\src\posh-git.psd1'
Import-Module oh-my-posh
Set-Theme Agnoster

Now, if you install the above you may encounter some strangeness with the font in that the glyphs required by oh-my-posh don’t correctly display, for example:

Screenshot of Windows Terminal with missing icons.

To resolve, I’ve headed over to Nerd Fonts and downloaded an amended font that contains all the required glyphs, in this case FiraCode.

You may also notice the small Stormtrooper in the bottom right, I use small images so that at a glance be able to tell which terminal I’m in, for example my PowerShell 7 display looks like:

Screenshot of Powershell 7.1 layout in Windows Terminal

Last but not least is a Windows Terminal cheat sheet I found last week (there’s probably more but this was the first one I found!).

Oh and if you’re wondering how I managed to mistakenly uninstall my terminal, I was doing some clean up with Chocolately to see what old installs I could get rid of. After running:

choco list --localonly

I noticed in the list was microsoft-windows-terminal 0.11.1121.0, which made sense as the first couple of beta installs were done via Chocolately (before it arrived in the Microsoft store), without hesitation I typed:

choco uninstall microsoft-windows-terminal

Of course (naively!) expecting that Chocolatey had installed it in a separate directory to my latest installation from the MS store, it hadn’t and wiped out my installation.

Happy coding!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s