Skip to main content

Windows

Setup your terminal#

While Oh my Posh works on the standard terminal, we advise using the Windows Terminal.

Installation#

scoop install https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/oh-my-posh.json

This installs a couple of things:

  • oh-my-posh.exe - Windows executable, added to your $PATH
  • oh-my-posh-wsl - Linux executable, added to your $PATH for use in the WSL
  • themes - The latest Oh my Posh themes

If you want to use a standard theme, you can find them in ~\scoop\apps\oh-my-posh\current\themes\, referencing them as such will always keep them compatible with the binary when updating Oh my Posh.

Usage#

Preview the themes#

Get-ChildItem -Path "$(scoop prefix oh-my-posh)/themes/*" -Include '*.omp.json' | Sort-Object Name | ForEach-Object -Process {
$esc = [char]27
Write-Host ""
Write-Host "$esc[1m$($_.BaseName)$esc[0m"
Write-Host ""
& "C:\tools\oh-my-posh.exe" -config $($_.FullName) -pwd $PWD
Write-Host ""
}

Update#

scoop update oh-my-posh

Replace your existing prompt#

You can find the themes scoop installs inside the "$(scoop prefix oh-my-posh)/themes/" folder. To use jandedobbeleer.omp.json for example, you can refer to it using "$(scoop prefix oh-my-posh)/themes/jandedobbeleer.omp.json" when setting the prompt using the --config flag.

The guides below use an imaginary theme called mytheme.omp.json, so make sure to replace that with your own, or one of the included themes.

info

If you have no idea which shell you're currently using, Oh my Posh has a utility switch that can you tell you (not relevant for the Powershell module).

oh-my-posh --print-shell

Edit $PROFILE in your preferred PowerShell version and add the following line.

Invoke-Expression (oh-my-posh --init --shell pwsh --config ~/mytheme.omp.json)

Once added, reload your profile for the changes to take effect.

. $PROFILE

Customize#

At this point you're good to go. The jandedobbeleer.omp.json theme displays most common use-cases in your prompt so 9/10 you'll be more than happy with it. However, if you want to explore additional functionality, going through the additional steps below will help you get started.

Change the theme#

We downloaded all the themes and set jandedobbeleer.omp.json as the one to use. However, there are a lot more to be discovered and maybe there are some you like better.

Override the theme settings#

Maybe there's a theme you like, but you don't fancy the colors. Or, maybe there's a segment you want to tweak/add, or replace some of the icons with a different one. Whatever the case, read through all available options first, by starting with the configuration guide.

You can output the current theme to the format you like (json, yaml or toml) which can be used to tweak and store as your custom theme.

Export-PoshTheme -FilePath ~/.mytheme.omp.json -Format json

Once you're done editing, adjust your $PROFILE to use your newly created theme.

Invoke-Expression (oh-my-posh --init --shell pwsh --config ~/mytheme.omp.json)

๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰