In this guide you will have all the links and necessary information to install Oh My Posh in Windows, GitBash and WSL/Linux.
You can copy each line and paste it in the terminal to an easy installation. You only need to modify the user folder.


Links of interest


Downloads before installation

Microsoft Store

You need this two apps from the store.

Nerdfonts

You have to download Nerdfonts and set in the Terminal in order to user Oh My Posh.


Installation of Oh My Posh in PowerShell

You have two options to install it:

1. Using Scoop

scoop install https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/oh-my-posh.json

2. Using Winget (recommended)

winget install oh-my-posh
  • If you receive a message that you need to refine the package name, you have two options:
winget install JanDeDobbeleer.OhMyPosh
  • or use the Microsoft Store version of Oh My Posh, which will automatically update when new versions are available (recommended):
    winget install XP8K0HKJFRXGCK

Install fonts

Run as administrator

oh-my-posh font install

Getting Themes

After the installation, you have to set the theme of the Oh My Posh.

  • Customize
  • Themes

    Install Themes

    oh-my-posh --init --shell pwsh --config ~/blueish.omp.json | Invoke-Expression

Get Themes

Get-PoshThemes

At the end of this command, you willl see the path of the files, which file you have to modify to display the theme and the path of that file.


Using Oh My Posh in PowerShell with $PROFILE

To use Oh My Posh in PowerShell, you need to to modify the $PROFILE file to set Oh My Posh as default terminal:

To edit the $PROFILE file:

code $PROFILE

We are setting blueish.omp.json as default theme. You can set the theme you want from the Get-PoshThemes command. You can also see available themes here

Edit the $PROFILE file with:

oh-my-posh --init --shell pwsh --config ~/blueish.omp.json | Invoke-Expression

or

oh-my-posh init pwsh --config C:\Users\USERNAME\AppData\Local\Programs\oh-my-posh\themes\blueish.omp.json | Invoke-Expression

The theme location folder is:
C:\Users\USERNAME\AppData\Local\Programs\oh-my-posh\themes

To change your theme, adjust the init script in (file from $PROFILE):
C:\Users\USERNAME\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1.

Just add this line in Microsoft.PowerShell_profile.ps1:
oh-my-posh init pwsh --config C:\Users\USERNAME\AppData\Local\Programs\oh-my-posh\themes\blueish.omp.json | Invoke-Expression


Using Oh My Posh in GitBash with $HOME

echo $HOME

In that location, create a file .bashrc and paste there

eval "$(oh-my-posh --init --shell bash --config C:/Users/USERNAME/AppData/Local/Programs/oh-my-posh/themes/blueish.omp.json)"

Install on Linux/WSL with $HOME

First update the Linux:

sudo apt-get update
sudo apt-get upgrade

Secondly install Brew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Run these two commands in your terminal to add Homebrew to your PATH:

echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/USERNAME/.profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

Install Homebrew’s dependencies if you have sudo access:

sudo apt-get install build-essential

We recommend that you install GCC:

brew install gcc

After brew is installed:

brew install jandedobbeleer/oh-my-posh/oh-my-posh

Find the $HOME route:

echo $HOME

In that location, find .profile and add at the end of that file:

eval "$(oh-my-posh --init --shell bash --config /mnt/c/Users/USERNAME/AppData/Local/Programs/oh-my-posh/themes/blueish.omp.json)"

or

eval "$(oh-my-posh --init --shell bash --config /home/USERNAME/blueish.omp.json)"

To refresh the terminal:

. ~/.bashrc

Terminal Icons in PowerShell

In PowerShell as Administrator:

Install-Module -Name Terminal-Icons -Repository PSGallery

Edit your C:\Users\USERNAME\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 and add at the end of the line

Import-Module -Name Terminal-Icons

Icons using colorls in Linux

Install Ruby

sudo apt install ruby ruby-dev git
sudo git clone https://github.com/athityakumar/colorls.git
cd colorls
sudo gem install colorls

Commands for colorls

colorls
colorls -a
colorls -l # View Permissions
colorls -S # Sort Files By size
colorls -d # Only Show Folders
colorls -1 # Tree
colorls --help #Help

Set alias from ls to colorls

Edit file in home/USERNAME/.bashrc and add at the end of that file:

alias ls='colorls'

Set alias in PowerShell

Set cl for clear

New-Alias -Name cl -Value clear

Add autocomplete in PowerShell

Just edit the $PROFILE and add:

# Shows navigable menu of all options when hitting Tab
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete

# Autocompletion for arrow keys
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward

VS Code Terminal

You have to download a Mono Space font from NerdFonts to use this feature

Control + Shift + P and type settings.json, and add at the end:

{
    "terminal.external.osxExec": "iTerm.app",
    "terminal.integrated.cursorBlinking": true,
    "terminal.integrated.fontFamily": "BitstreamVeraSansMono Nerd Font",
    "terminal.integrated.fontSize": 11,
}

Reload Powershell without restarting the terminal

& $profile

Autocomplete with ⬇ and ⬆ in WSL

Run in your bash:

cat >> ~/.inputrc <<'EOF'
"\e[A": history-search-backward
"\e[B": history-search-forward
EOF

Open a new shell session, or just reload inputrc:

bind -f  ~/.inputrc

Now use ⬆ and ⬇ after entering the beginning of the command – it will auto-complete from history.