Skip to content

Oh My Posh

Oh My Posh is a tool designed to enhance the user experience and productivity of individuals working with command-line interfaces by allowing them to customize their shell prompts.


Install Windows Terminal

winget install --id Microsoft.WindowsTerminal -e

Install Oh My Posh

winget install JanDeDobbeleer.OhMyPosh --source winget --scope user --force

Check for updates for Oh My Posh

winget upgrade JanDeDobbeleer.OhMyPosh --source winget --scope user --force

Install a font

oh-my-posh font install <font name>

Choose your font, I like Meslo.

Configure apps to use the Font

Windows Terminal

Once installed configure Terminal to use it by editing the settings.json file. An easy way to open this file is to hit Ctrl + Shift + , when Terminal is in focus.

Under the defaults block set the font.

{
    "profiles":
    {
        "defaults":
        {
            "font":
            {
                "face": "MesloLGM Nerd Font"
            }
        }
    }
}

Visual Studio Code

Whilst in VScode enter Ctrl + , to open the Settings page. Search for Integrated: Font Family and paste the name of the Font you are using.

Configure Powershell to use Oh My Posh

Open the Powershell profile text file.

notepad $PROFILE

Add the following line

oh-my-posh init pwsh | Invoke-Expression

Reload your Powershell session to trigger the change

. $PROFILE

Warning

You may encounter an error about running scripts

Run the following in an elevated Terminal

Set-ExecutionPolicy RemoteSigned

Themes

An easy way to use a theme is to live load it from the GitHub repo which will cache it to your system. To use a theme just edit the command from above and provide the URI for the theme. Below I have configured my Terminal to use thecyberden theme.

oh-my-posh init pwsh --config 'https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/thecyberden.omp.json' | Invoke-Expression

Predictive Intellisense

Install the library.

Install-Module -Name PSReadLine -Scope CurrentUser -Force -SkipPublisherCheck

Add this to $PROFILE

# Add auto complete (requires PSReadline 2.2.0-beta1+ prerelease)
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -EditMode Windows

My $PROFILE

# Load oh-my-posh
oh-my-posh init pwsh --config 'https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/thecyberden.omp.json' | Invoke-Expression

# Add auto complete (requires PSReadline 2.2.0-beta1+ prerelease)
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -EditMode Windows

# Additional icons
Import-Module -Name Terminal-Icons