Scott Hanselman explained how to make a pretty prompt in the Windows Terminal.

I’d like to list additional hints where and what to tweak in the Windows Terminal in order to make it even more convenient and nicer as the daily tool.

First, it make sense to install the latest version of PowerShell, the Core one instead of what Windows has pre-installed.

Change color schema

Windows Terminal supports different color schemes. In order to change the default one, open Settings file (Ctrl+,) and add the following line with the name of the color schema:

"profiles": { "defaults": { "colorScheme": "One Half Dark" } }

Blurred transparent background

To make terminal transparent and a blurred add the following lines to the same default profile settings:

"profiles": { "defaults": { "useAcrylic": true, "acrylicOpacity": 0.5 } }
Blurred transparent background

Play with the values to find the most pleasant for you.

Surprisingly, these changes require restart of the Windows Terminal.

Initial number of columns and rows

To set the initial number of columns and rows when Windows Terminal launches, configure the following in the Settings:

"profiles": { "defaults": { "initialCols": 120, "initialRows": 60 } }

Note, that the number of columns and rows changes dynamically as the window is resized. But the settings shown above allow configuring, basically, how large will be the window from the beginning.

Key bindings for managing tabs

It’s nice to have hotkeys to quickly create a new tab, close the current one, or, sometimes, to duplicate it. Similar to what is available in every modern browser. There is the keybindings section in the Settings where keys can be set as needed.

The JSON snippet below configures the following:

  • Ctrl+T – create a new tab (open the terminal using the profile set as a default one);
  • Ctrl+W – close the currently active tab;
  • Ctrl+D – duplicate the currently active tab.
"keybindings": { { "command": { "action": "newTab", "index": 0 }, "keys": "ctrl+t" }, { "command": { "action": "duplicateTab" }, "keys": "ctrl+d" }, { "command": { "action": "closeTab" }, "keys": "ctrl+w" } }

Don’t hesitate to check the documentation page with even more commands described.

Custom profiles

Windows Terminal has few terminal profiles preconfigured: Command Line, PowerShell, WSL. It’s very easy to extend the list by adding additional ones. For example, the following snippet describes a profile that opens an SSH to the docker machine:

"profiles": { "list": [ { "guid": "{2c4fc342-38b7-51cf-b940-2304a097f51f}", "name": "Docker Machine", "commandline": "ssh example.docker.machine.com", "icon": "C:/Program Files/Docker/Docker/resources/ddvp.ico", "hidden": false } ] }

The snippet also configures an icon to be displayed in the menu. It can be a path to the image on the local machine, or even a URL (but better don’t do it).

If you don’t need some pre-configured profiles, I’d recommend to not delete them but set "hidden": false instead. Anyway, Windows Terminal restores them somehow.

Remove user name and machine name

By default, PowerShell displays the user and machine name in front of each line:

A terminal with user name and machine name

If you don’t need this information it can be removed in the startup profile.

Open the profile script for editing:

notepad $PROFILE

Add the following line on top of it:

$global:DefaultUser = [System.Environment]::UserName

As a result, user name and machine name are not shown anymore:

A terminal without user name and machine name

Start with a clean screen

When a new PowerShell terminal starts, it outputs some basic information:

Basic informational lines when PowerShell starts

In order to have a clean terminal from the beginning, just add the clean command at the end of the profile script.

Install Windows Terminal into content menu of the Explorer

In order to have a possibility to quickly open the Windows Terminal in the current Explorer folder, use the scripts published on GitHub.

The solution above is temporary one. This feature should be officially introduced later by Microsoft.

VS Code integration

Speaking about integration into VS Code, we actually configure PowerShell itself. It doesn’t make sense to try to integrate Windows Terminal there.

The following lines in the settings.json file makes the PowerShell a default terminal.

"terminal.integrated.shell.windows": "C:\\Program Files\\PowerShell\\7\\pwsh.exe", "terminal.integrated.fontFamily": "Cascadia Code PL"

If you set the path to the same PowerShell as was used in the Windows Terminal during the configuration of modules according to Scott Hanselman’s post, you will get the same beautiful and convenient prompt directly in the VS Code.

JetBrains Rider integration

Similar to VS Code perform the following steps:

  1. Set the Settings → Tools → Terminal → Shell path to C:\Program Files\PowerShell\7\pwsh.exe
  2. In the Settings → Editor → Color Scheme → Console Font set the Font = Cascadia Code PL
  3. In the Settings → Editor → Color Scheme → Console Colors copy the value of Console.Background.Background to ANSI Colors.Black.Foreground. This fixes the background of the arrow chars.

Add comment