How to set up Terminal Oh-my-Posh for a better user experience
Overview
Since the release of the new Terminal application in windows, I have been using more and more powershell, bash and cmd to perform some tasks. At some point, as a dev, I am often missing git informations. When watching conferences I have realized there was a tool that could help with that : Oh My Posh. So I have been using it for a while now, but I m always forgetting to configure some parts of it. Like setting the proper font in Visual Studio Code, etc… Here are my personal notes to not forget about those anymore when setting up new boxes.
Oh my Posh
Installation
For windows :
|
|
For Windows server :
|
|
For linux :
|
|
Themes
Official themes are available ‘
here
’.
In Windows, edit $PROFILE
|
|
The file saved is located here : C:\Users\{CurrentUser}\OneDrive\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
.
To change the location use : Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "Personal" -Value "MyLocation"
Navigating to a git repo folder and executing ‘Get-PoshThemes’ in the Terminal windows will show a preview of all the installed theme for the current folder.
Themes are located here : C:\Users\{CurrentUser}\AppData\Local\Programs\oh-my-posh\themes\
.
In Linux, edit ~/.bashrc
considering all my themes are located in folder ~/.poshthemes
.
|
|
Fonts
Easy installation from Powershell with elevated rights :
|
|
Visual Studio Code
In Linux or Wondows, open Visual Studio Code. Go to File, Preferences, Settings. Search for ’terminal font family’ and set the value with the Nerd font installed.
Alternatively, edit the ‘settings.json’ file and add :
|
|
Visual Studio
The commitMono will not be recognized by Visual Studio. Use Meslo
, Meslo
or Cousine
instead. Other fonts can work, but we need TTF fonts instead of OTF for them to appear in Visual Studio.
Easy Font installation from Powershell with elevated rights :
|
|
Then In Visual Studio, go in Tools, Options, Fonts and Colors then select Terminal and set the font to the Nerd font installed.
Terminal & WSL bashes
For each instances where we want to install the Oh-My-Posh, go in Settings, then select the Terminal (like Powershell, or Ubuntu).
Scroll down to Appearance
and Set the Font-Face to your favourite Nerd Font.
|
|
Once Oh-My-Posh is installed, edit ~/.bashrc
considering all my themes are located in folder ~/.poshthemes
.
|
|