You can install oh-my-posh
per terminal but you can also use winget
for the easiest installation. It will apply to all available terminals on your system.
Open a PowerShell prompt and run the following command:
winget install oh-my-posh
You can initialize OMP manually via the terminal or have the terminal init OMP atomically using your Profile script.
Run the following command in the terminal to start it manually
oh-my-posh init pwsh | Invoke-Expression
Run the following command to open your profle script
notepad $PROFILE
Then add the following init line
oh-my-posh init pwsh | Invoke-Expression
Oh My Posh comes with a default theme. The following command will display all themes in the current path and download them to your local profile location.
Get-PoshThemes
This is very convenient as it shows you what the current path looks like for each theme and you also have the local copy to use in your profile init script.
Themes location: C:\Users\{YOURNAME}\AppData\Local\Programs\oh-my-posh\themes
To change your theme, adjust the init script in C:\Users\{YOURNAME}\Documents\PowerShell\Microsoft.PowerShell_profile.ps1.
Example:
oh-my-posh init pwsh --config C:\Users\{YOURNAME}\AppData\Local\Programs\oh-my-posh\themes/jandedobbeleer.omp.json | Invoke-Expression
Now choose one, open your init script again and add the --config line with the correct theme config to the script
oh-my-posh init pwsh --config C:\Users\{YOPURNAME}\AppData\Local\Programs\oh-my-posh\themes/jandedobbeleer.omp.json | Invoke-Expression
Most themes use some icons to display location info, git status or Azure information. This is done using the common font Nerd Font.
The fonts can be easily installed using the OMP CLI.
Run the following command to install your favorite face from the Nerd Font collection. OMG recommends Meslo LGM NF
so we will use that in the example.
oh-my-posh font install
Scroll down to the font with name Meslo
and install the font. After a restart of the terminal you need to set the font in the settings.
- Open (or restart) your windonws terminal and open the settings.
- Either configure the font global (default) of per terminal.
- Select the font 'MesloLGM Nerd Fonts' as your font.
- The changes should reflect you new font.