Oh My Posh

Oh My Posh is a prompt theme engine for any shell which means it is cross platform for any shell language like Bash, zsh, or Powershell. Since we just set up WSL, we can get this working for both our PowerShell and Bash prompts.

  1. If on Windows, ensure you install a Nerd Font on the Windows system itself.
git clone https://github.com/ryanoasis/nerd-fonts.git
cd nerd-fonts
./install.ps1 FiraCode

Replace FiraCode with any font you like.

  1. Oh My Posh does come with prebuilt themes, however, I found it easier to extract a theme directly to the home folder, customize it, then load it from there. The following are the themes I use for PowerShell and Bash. You can download those or choose your own theme here.

  2. In the terminal settings > Appearance > select the Nerd Font you downloaded. Ensure this is done for both PowerShell and each distribution you use. You can also change the background color from there.

  3. If using WSL, install the Homebrew package manager on the Linux system side.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Next, we can install Oh My Posh. It was easier for me to have separate installations for WSL and PowerShell.

From PowerShell:

winget install oh-my-posh

From WSL:

brew install jandedobbeleer/oh-my-posh/oh-my-posh
  1. Next, we need to add the oh-my-posh command to our $PROFILE variable on Windows and either our .bashrc or .profile for WSL. In my case, the .bashrc configuration didn’t work for me and I had to put the command in the .profile file.

On the Windows side:

notepad $PROFILE

Add the following line, replacing it with whichever theme you chose:

eval "$(oh-my-posh init bash --config ~/grandpa-style.omp.json)"

Save and exit the terminal.

On the WSL side:

nano .profile

Add the following line, replacing it with whichever theme you chose:

eval "$(oh-my-posh init bash --config ~/sven.omp.json)"

Save and exit the terminal.

  1. Last thing is to reload the terminal. If all the changes were successful, you should now see your custom prompt load as soon as the terminal starts. If not, double check the documentation to see if any steps changed.

References / Additional Info

Oh My Posh

Nerd Fonts

Homebrew

How to make the ultimate Terminal Prompt on Windows 11 - This video is LONG and WORDY and DETAILED - YouTube