2

Today I installed posh-git in the PowerShell but the icons are not showing instead showing a rectangle box with a question mark inside. Below are the steps I followed to:

Install-Module oh-my-posh -Scope CurrentUser

then

Install-Module posh-git -Scope CurrentUser

For both packages, I have selected the Yes To All option.

After installing the packages, I opened Microsoft.PowerShell_profile.ps1 file and added the following snippet:

Import-Module oh-my-posh
Import-Module posh-git

Set-PoshPrompt -Theme M365Princess
# M365Princess is the theme name I found from oh-my-posh doc

After this in the VS Code settings.json I added this "terminal.integrated.fontFamily": "Fira Code".

FYI, I have installed the Fira Code Medium Nerd Font Complete Windows Compatible font already.

Then restarted by VS Code. Color is showing perfectly and also some icons but also some are missing like the example in the below screenshot.

Posh Git

Please help me out with how I can solve this.

Barefaced Bear
  • 688
  • 1
  • 9
  • 30
  • Does this answer your question? [Oh-my-posh themes not working correctly with Powerline font and ConEmu](https://stackoverflow.com/questions/61479157/oh-my-posh-themes-not-working-correctly-with-powerline-font-and-conemu) – Daniel Jul 08 '22 at 05:59
  • You have to change you fonts, personaly I use CaskaydiaCove Nerd font. Have a look to [How to make a pretty prompt in Windows Terminal with Powerline, Nerd Fonts, Cascadia Code, WSL, and oh-my-posh](https://www.hanselman.com/blog/how-to-make-a-pretty-prompt-in-windows-terminal-with-powerline-nerd-fonts-cascadia-code-wsl-and-ohmyposh) – JPBlanc Jul 08 '22 at 06:32

3 Answers3

2

Use the recommended font from oh my posh https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/Meslo.zip

More info at https://ohmyposh.dev/docs/installation/fonts

oh my posh fonts

lazy firos
  • 21
  • 3
0

Two things, first, do not use the module anymore as that's no longer supported. More info here. Secondly, set the correct font so the icons can render, as that's why you see

Jan De Dobbeleer
  • 566
  • 4
  • 12
  • Hey @Jan, I tried with multiple fonts even saw some answers in stack and tried those also. What I noticed is my IntelliJ integrated powershell is showing the icons properly but not in VS Code or windows default powershell – Barefaced Bear Jul 29 '22 at 13:07
  • hey @BarefacedBear you do need to adjust the font settings for all terminals. That's not something oh-my-posh can do for you. – Jan De Dobbeleer Aug 03 '22 at 07:16
0

I was leading with the same problem. This solved it for me.

Install one of the nerd fonts recommended by oh-my-posh

oh-my-posh install fonts

Once that they are installed, you should change the properties of the command shell. In windows terminal, you change the settings.json and add:

{
    "profiles":
    {
        "defaults":
        {
            "font":
            {
                "face": "MesloLGM Nerd Font"
            }
        }
    }
}

In PowerShell, you go to properties > fonts and select one of nerd fonts.

If you need to charge the profile again, you can do it with . $PROFILE.