Oh My Posh Powerline

Oh My Posh Powerline

There are a number of posts about Oh My Posh and using it to make the Windows Terminal. I am not sure there is much I can add. But here is what I have learnt setting up my new work laptop.

Windows Terminal

To install the Oh My Posh library, I used Chocolatey to do the heavy lifting by running the command choco install oh-my-posh

After installing the library, I needed to make sure I had a Nerd font installed that contains the additional glyphs. I ended up downloading and installing Caskaydia Cove Nerd Font, which is close to the fonts I like.

I then needed to set the profiles with VSCode and Windows Terminal to use the font by default. Without a nerd font installed, all the extended glyphs would appear as squares.

Customisation

I looked at the various themes available within the GitHub repo, and I felt none completely did want I wanted. So I decided to create my own.

Early in the testing, I found having elements on the right side of the prompt caused rendering issues when resizing windows. So I decided to keep all segments to the left.

Looking at Pixel Robot’s theme he has configured kubectl and Azure elements, alongside the more standard User, Path and Git segments. Due to my new role, I liked the idea of adding the Azure element. But I currently do not use AKS or Kubernetes regularly, so the kubectl segment is unnecessary, adding noise to the terminal.

I also decided to split the information over two lines, as I had seen in several themes. I liked the fact it gave a reasonable amount of space for commands to be written.

The final configuration I ended up with is as follows: Final Configuration of Terminal prompt

Setting Profiles

PowerShell

I updated the PowerShell Profile %USERPROFILE%\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 with the following line Set-PoshPrompt -Theme <Theme JSON File Location>

Linux

I updated the ~/.bashrc file with the additioal line eval "$(oh-my-posh --init --shell bash --config <Theme JSON File Location>)"

Further Reading