Windows #
PowerShell #
Install Oh My Posh.
winget install JanDeDobbeleer.OhMyPosh --source winget
Install a font.
oh-my-posh font install meslo
Set the installed font as the PowerShell default font.
MesloLGM Nerd Font
Apply Oh My Posh.
Open Microsoft.PowerShell_profile.ps1.
notepad $PROFILE
Modify Microsoft.PowerShell_profile.ps1.
PowerShell | Microsoft.PowerShell_profile.ps1 # Find your local configuration file. $MyThemePath = Join-Path (Split-Path $PROFILE) "cert.omp.json" oh-my-posh init pwsh --config $MyThemePath | Invoke-Expression # Press the Tab key to accept the cloudy gray suggestion. Set-PSReadLineKeyHandler -Key Tab -Function AcceptSuggestion
Create cert.omp.json in the same directory as Microsoft.PowerShell_profile.ps1.
JSON | cert.omp.json { "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", "blocks": [ { "alignment": "left", "segments": [ { "background": "#E36464", "foreground": "#fff", "leading_diamond": "", "style": "diamond", "template": "{{ .UserName }} ", "trailing_diamond": "", "type": "session" }, { "background": "green", "foreground": "#fff", "leading_diamond": "", "options": { "style": "folder" }, "style": "diamond", "template": " {{ .Path }} ", "trailing_diamond": "", "type": "path" }, { "background": "lightCyan", "foreground": "#fff", "leading_diamond": "", "options": { "branch_icon": "" }, "style": "diamond", "template": " git({{ .HEAD }}) ", "trailing_diamond": "", "type": "git" }, { "background": "lightMagenta", "foreground": "#fff", "leading_diamond": "", "options": { "time_format": "15:04" }, "style": "diamond", "template": " {{ .CurrentDate | date .Format }} ", "trailing_diamond": "", "type": "time" } ], "type": "prompt" }, { "alignment": "left", "segments": [ { "foreground": "#fff", "style": "plain", "template": "\n❯", "type": "text" } ], "type": "prompt" } ], "final_space": true, "version": 4 }
Refresh Microsoft.PowerShell_profile.ps1.
. $PROFILE