Customizing your Windows terminal using Oh-My-Posh can greatly enhance your command line experience. Follow these steps to get started:
-
Installation
a. Install Oh-My-Posh using Winget:
winget install JanDeDobbeleer.OhMyPosh -s winget
b. Alternatively, you can install it manually:
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://ohmyposh.dev/install.ps1'))
c. Verify the installation by running:
oh-my-posh.exe
-
Install Nerd Fonts
Visit NerdFonts and download your preferred Nerd Font. For example, you can download 'Hack Nerd-Font'.
-
Create a PowerShell Profile
Run the following command to create a PowerShell profile:
echo 'test string' > $PROFILE
-
Configure Themes
a. Open the PowerShell profile in Visual Studio Code:
code $PROFILE
b. Add the following command to initialize and set a theme (modify as desired):
oh-my-posh --init --shell pwsh --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v$(oh-my-posh --version)/themes/jandedobbeleer.omp.json | Invoke-Expression
-
Additional Customization
a. Folder Icons - Install 'terminal-icons':
Install-Module -Name Terminal-Icons
b. History Command Enhancements - Install 'PSReadLine':
Install-Module -Name PSReadLine -AllowPrerelease
-
Import Modules
Add the following lines to your PowerShell profile:
Import-Module -Name Terminal-Icons Import-Module -Name PSReadLine Set-PSReadLineOption -PredictionSource History Set-PSReadLineOption -PredictionViewStyle ListView Set-PSReadLineOption -EditMode Windows