powershellshellcustomizationpromptposh-git

Oh-my-posh themes not working correctly with Powerline font and ConEmu


I use PowerShell as my shell on Windows 7. I find that ConEmu is a really good terminal. Since I am not on Windows 10, I cannot use Windows Terminal but ConEmu is not bad at all. I found out about posh-git and oh-my-posh and how they can customize your PowerShell experience. I installed oh-my-posh and the Paradox theme looked nice. But I saw some empty boxes in random places in my Prompt. paradox-issue

And this is an issue that I face on all the themes. The colors and the design are beautiful and I want to use it but those weird boxes are keeping me from doing that. I would also like to tell that I am using Cascadia Code as my font and also this is the Powerline version of Cascadia Code. So, I think it should work as excepted. Next, trying to fix this, I went to nerdfont.com and I installed Cascadia Code from there as opposed to Microsoft's official GitHub repository. Then I set ConEmu's font to Cascadia which I installed from nerdfonts and this happened: enter image description here

It's better in a way that I can see the Python symbol and some more symbols but still there is one box that cannot be rendered. But it does get worse if I change repository: enter image description here

There is a weird question mark after "master". I think I have met all the prerequisites to use oh-my-posh like install posh-git and PSReadLine and having powerline Cascadia Code font and also using ConEmu as they officially suggest. I would absolutely appreciate it a lot if anyone can help me out of this mess and suggest what to do to fix my prompt.

P.S I am using PowerShell 7 Core.


Solution

  • When you see boxes, that means that the font doesn't have that specified character. e.g. there are a lot of specialized fonts that don't have every character location defined.

    Right on the oh-my-posh GitHub page, Quote:

    In case you notice weird glyphs after installing a font of choice, make sure the glyphs are available (maybe they have a different location in the font, if so, adjust the correct $ThemeSettings icon). If it turns out the character you want is not supported, select a different font.

    Also on the oh-my-posh GitHub page, the font used is:

    The fonts I use are Powerline fonts, there is a great repository containing them. I use Meslo LG M Regular for Powerline Nerd Font

    If using Meslo LG M Regular doesn't solve your problem, then you have to manually remap the icons to the correct unicode locations in your chosen font.

    For Version 2 of Oh My Posh, you have to edit the $ThemeSettings variable. Follow the instructions on the GitHub on configuring Theme Settings. e.g.:

    $ThemeSettings.GitSymbols.BranchSymbol = [char]::ConvertFromUtf32(0xE0A0) 
    

    For Version 3+ of Oh My Posh, you have to edit the JSON configuration file to make the changes, e.g.:

    ...
    {
        "type": "git",
        "style": "powerline",
        "powerline_symbol": "\uE0B0",
    ....