Customize the Windows Terminal and Powershell 7.
You need to install the following software to use this configuration:
- Install the Windows Terminal from the Microsoft Store (Windows 10 only).
- Install Fira Code from Nerd Fonts.
- Install Powershell 7 using
winget search Microsoft.PowerShell
.
Personalize your prompt with Oh My Posh. Install it using the following command:
winget install JanDeDobbeleer.OhMyPosh -s winget
This command install a couple of things:
- oh-my-posh.exe - Windows executable
- themes - The latest Oh My Posh themes
After installing Oh My Posh, you can set the theme for powershell. You can view their documentation for more information. Important to note that Oh My Posh is designed to use Nerd Fonts.
We will configure the Powershell 7 profile to use Oh My Posh and Phantom theme. Open the profile using the following command:
code $PROFILE
It will open the profile in Visual Studio Code. Copy profile.ps1 provided in this repository and paste it in the profile. Save the file and reload the prompt using the following command:
. $PROFILE
You can read more about profile.ps1 in the section below.
The profile.ps1 is a script that runs every time you open powershell. The profile provided in this repository is configured to include Oh My Posh and Phantom theme. You can customize the profile to include more modules or themes.
The profile includes the following modules which are required for Phantom theme to work properly
Posh Git is a PowerShell environment for Git. It provides Git status information and tab completion. You can find more information about Posh Git in their repository
Terminal Icons is a PowerShell module that provides icons for files and folders. You can find more information about Terminal Icons in their repository
Module which need to be updated.
The profile execute Oh My Posh with the custom theme Phantom by default.
The profile some optional scripts that you can use to customize your prompt. Is not required to use them.
The script provides auto-completion for .NET commands. You can use it by typing dotnet
and pressing TAB
.
The script provides auto-completion for winget commands. You can use it by typing winget
and pressing TAB
.
The script provides auto-completion for gh commands. You can use it by typing gh
and pressing TAB
.
You need to install the respective software to use the auto-completion.
We will configure the Windows Terminal to add a new profile for Powershell 7. Copy this section in the profiles section of the settings.json file.
{
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"name": "Bash",
"icon": "https://cdn.jsdelivr.net/gh/beauchama/phantom@main/assets/bash.png",
"source": "Windows.Terminal.PowershellCore",
"startingDirectory": "Path which you want to start",
"useAtlasEngine": true,
"suppressApplicationTitle": true,
"hidden": false,
"adjustIndistinguishableColors": "always",
"colorScheme": "Vintage",
"cursorShape": "vintage",
"cursorColor": "#00bdd0",
"foreground": "#00bdd0",
"font":
{
"face": "FiraCode Nerd Font",
"size": 14.0
}
}