Table of Contents
Oh My Posh
Oh my is a prompt theme engine for PowerShell. It has many builtin themes and you can also create your own theme if you want. Lets see how you can install it and setup ohmyposh.
Install in PowerShell Module
Install-Module oh-my-posh -Scope AllUsers
This will install ohmyposh to all the users.
If you are using the older version of the Oh My Posh. please update or uninstall the module.
To update
Update-Module -Name oh-my-posh
To uninstall
UnInstall-Module -Name oh-my-posh
Install fonts
Oh My Posh uses Nerd Font. It is recommed to use Meslo Lgm NF
Download the fonts and install install it.
Setting the font in Windows Terminal
Once the font is installed set the font as a default font in Windows Terminal.
{
"profiles": {
"defaults": {
"fontFace": "MesloLGM NF"
}
}
}
View themes and select one you like
Get-PoshThemes
Import module and set theme
Once you have decided on the theme we can import module and set the theme.
We need to update the PowerShell profile to import and set the theme.
To open the profile use this command.
notepad.exe $PROFILE
This will open the PowerShell profile in notepad.
Update the PowerShell with the following
Import-Module oh-my-posh
Set-PoshPrompt powerlevel10k_rainbow
This will import the Oh My Posh and set the theme.
Install PSReadLine and PowerShellGet
Before updating PowerShellGet, you should always install the latest NuGet provider. From an elevated PowerShell session, run the following command.
Install-PackageProvider -Name NuGet -Force
Install or update the PowerShellGet
To install
Install-Module -Name PowerShellGet -Force
To update
Update-Module -Name PowerShellGet
Install PSReadLine
To install
Install-Module -Name PSReadLine -AllowPrerelease
Import and configure PSReadLine
Open the powershell profile
notepad $profile
Add the PSReadLine config
Import-Module PSReadLine
Set-PSReadLineOption -EditMode Windows
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -PredictionViewStyle InlineView
For more config look here
Install Terminal-Icons
To install the module from the PowerShell Gallery:
Install-Module -Name Terminal-Icons -Repository PSGallery
Open the powershell profile
notepad $profile
Import the terminal font
Import-Module -Name Terminal-Icons
Open a new prompt and verify if you the icons with the following command
Get-ChildItem -Path . -Force
Related Posts
Set up Wsl with zsh and oh-my-zsh
In this post we will see how to setup zsh shell in the wsl and use oh-my-zsh.
Set up Windows Terminal with PoshGit, oh-my-posh and Cascadia Code PL
In this post we will see how to setup windows terminal with PoshGit and oh-my-posh to make the terminal more productive