powershell > colors and git with oh-my-posh

abstract

The concern is documenting the colorization of powershell via oh-my-posh (a variation on linux-based oh-my-zsh). I am strongly advocating for using Meslo font and Avit theme — but it may be possible to customize as per personal taste, too. The beginning of the terminal looked:

1. install modules

Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser

2. change font

  • go to Releases · ryanoasis/nerd-fonts
  • download one fo the selected fonts — I go for Meslo because it has all unicode characters needed for GIT
  • extract the package into a dedicated folder
  • download install.ps1 and put it into the same folder with extracted fonts
  • run ./install.ps1 to import the fonts into Windows
  • run the command to install the MesloLGMDZ Nerd Font Mono (or the font name of your choice) as a terminal font
Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Console" -Name "FaceName" -Value "MesloLGMDZ Nerd Font Mono" -Type String;
  • restart console (note the change of the typeface — not striking at first)

3. set-prompt

• run Set-Prompt

4. set-theme

  • run Set-Theme Avit
  • optionally, run Get-Theme to get a list of available themes and try if something else suits you better

5. modify profile

  • open your PowerShell profile with ii $profile
  • put the following lines at the top of the profile to make the change persistent across sessions
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Avit

sources

Technical Support Engineer of a Data Collection Platform (Snowplow Analytics)