If you haven’t already, placing a customisation on your command prompt for PowerShell is a great way to gain extra context in given activities. For example, if you would like to have a comprehensive overview of your Git status summary information, then posh-git is for you.
Be Careful: Adding customisations will bring latency to start-up
One customisation that I came across that I really like is the cloud-native-azure theme using Oh My Posh. The theme gives context to the following:
- Path.
- Git status summary with changing colours and glyphs depending on status.
- Command execution status.
- Terminal Type (pwsh, shell, etc.)
- Battery Status.
- Date and Time.
- Kubernetes Context.
- The part I really like | Azure Subscription Context.
For me, this theme really ticks the box, having both context of git status information and the Azure context in which I may be working is a real productivity assist.
Oh My Posh Theme Install
To install and enable the theme for your command prompt for PowerShell, you will need to do the following:
- Install a font.
- Often these customisations will make use of glyphs (graphic symbols) to assist in conveying information quickly.
- I made use of Nerd Font - 0xProto Nerd Font
- Simply:
- Install the font.
- Unzip the download.
- Right Click and Install the .ttf files.
- Enable the font in Windows Terminal.
- Open the Windows Terminal.
- Press
ctrl+,
to get to Windows Terminal Settings. - Under Profiles, select Windows PowerShell.
- Under Additional Settings, select Appearance.
- Select the drop-down for Font Face and select your downloaded font. For me this is 0xProto Nerd Font.
- Install Oh My Posh.
- Apply your theme of choice, or in this case cloud-native-azure.
- Simply:
- Load your PowerShell profile through your editor of choice:
> code $PROFILE
/> notepad $PROFILE
- If you receive a path error, a profile may not have been setup for you yet. To sort this, use the following PowerShell command:
> new-item -type file -path $profile -force
- Then run the previous command to open the profile for editing.
- Add the following initiation line for oh-my-posh for your given choice of theme
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\cloud-native-azure.omp.json" | Invoke-Expression
- Load your PowerShell profile through your editor of choice:
- Simply:
Now the next time you load up your PowerShell terminal, you can enjoy the awesome customisation and hopefully get some productivity benefits too.