oh-my-posh, the perfect companion to give PowerShell some style and functionality.
Let me walk you through how I set it up with Cascadia Code Nerd Font and configured KDE Konsole for a smooth experience. Spoiler alert: it's simple but super effective.
Oh and guess what: This all works on Windows using Windows Terminal, too.
First, we need to install oh-my-posh. It's as easy as running this command:
curl -s https://ohmyposh.dev/install.sh | bash
This script downloads the latest version of oh-my-posh and installs it. Feel free to inspect the script if you're cautious. If you're running Windows the installation is slightly different, but I guess you figure this out.
oh-my-posh relies on a Nerd Font for its icons and styling. I chose Cascadia Code Nerd Mono because it's clean and works beautifully across different environments.
oh-my-posh font install
Set the Font in KDE Konsole:
Set the Font in Windows Terminal:
To make oh-my-posh work seamlessly in PowerShell, edit your $PROFILE
file.
code $PROFILE
Add the following lines to load oh-my-posh with your configuration:
oh-my-posh init pwsh --config "/path/to/oh-my-posh.json" | Invoke-Expression
clear
This initializes oh-my-posh with your chosen theme and clears the screen for a clean start.
Here's my oh-my-posh config file. It's simple but does the job perfectly:
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"properties": {
"cache_duration": "none",
"style": "full"
},
"template": "{{ .Path }} ",
"foreground": "#77E4F7",
"type": "path",
"style": "plain"
},
{
"properties": {
"cache_duration": "none"
},
"template": "{{ .HEAD }} ",
"foreground": "#FFE700",
"type": "git",
"style": "plain"
},
{
"properties": {
"cache_duration": "none"
},
"template": "$ ",
"foreground": "#43D426",
"type": "text",
"style": "plain"
}
]
}
],
"version": 3
}
Let's set up a dedicated profile for PowerShell in Konsole:
Duplicate an Existing Profile:
Configure the PowerShell Profile:
With oh-my-posh, Cascadia Code Nerd Font, and a dedicated profile in KDE Konsole, my PowerShell setup is consistent, stylish, and super effective. Whether I'm on Fedora, a VM, or a devcontainer, my terminal always feels like home.
If you're a PowerShell fan like me, give this setup a try. Trust me, your terminal (and your productivity) will thank you.