romkatv / powerlevel10k

A Zsh theme
MIT License
45.93k stars 2.17k forks source link

Support Powerline fonts such as Fira Code and Cascadia Code PL #839

Closed felipecrs closed 4 years ago

felipecrs commented 4 years ago

First of all, I have to say that this theme is awesome. By far the best over there.

Fonts such as Fira Code and Cascadia Code PL are ones of the most popular ones currently. Cascadia Code for example is the default font in Windows Terminal.

Not everyone likes the style of the recommended font, so my suggestion here would be to at least support the Powerline icons.

When I run p10k configure with both fonts, I'm able to see the first rotated square icon, but not able to see the two other lock icons. So when I finish the configuration, there are no Powerline icons in the terminal prompt, such as the Git ones.

asciicast

romkatv commented 4 years ago

Powerlevel10k works with all fonts. Simply run p10k configure and answer the questions in the wizard.

So when I finish the configuration, there are no Powerline icons in the terminal prompt, such as the Git ones.

This is because the font your terminal using doesn't have these glyphs. These aren't powerline glyphs by the way.

felipecrs commented 4 years ago

@romkatv I understood.

However, this is what this issue is for: to open the discussion about supporting Powerline glyphs.

Maybe I can change the wording because with the last paragraph I made it sounds like a bug.

romkatv commented 4 years ago

The first few question in the powerlevel10k wizard assess the capabilities of your terminal's font. Powerlevel10k needs to know whether your terminal can display powerline glyphs, font awesome glyphs, nerd font glyphs, etc. Then it will offer you different prompt styles to choose from. It will not use glyphs that it knows your terminal cannot display.

If you want to see the GitHub glyph in your terminal, you need to use a font that has that glyph. The default font in Microsoft Terminal doesn't have it.

felipecrs commented 4 years ago

If you want to see the GitHub glyph in your terminal, you need to use a font that has that glyph. The default font in Microsoft Terminal doesn't have it.

I fully understand that. What I'm trying to say is that the theme could show some Powerline glyphs for Git (just one example) in case the font has the Powerline glyphs but not Nerd Font glyphs.

romkatv commented 4 years ago

Which powerline glyph would you like to see in place of GitHub logo? There are four of them in total. The following command will print them all:

print '\uE0B0 \uE0B1 \uE0B2 \uE0B3'
felipecrs commented 4 years ago

One example:

print '\ue0a0'

image

romkatv commented 4 years ago

How about GitLab logo?

romkatv commented 4 years ago

Anyway, you can change the format of Git status in prompt as described here: https://github.com/romkatv/powerlevel10k/blob/master/README.md#how-do-i-change-the-format-of-git-status.

felipecrs commented 4 years ago

Actually, I didn't mean any company-specific logo, since they're not part of Powerline. Instead, the supported Powerline glyph for version control, such as the one I showed.

romkatv commented 4 years ago

I'm confused. Could you clarify what you want changed in powerlevel10k?

felipecrs commented 4 years ago

I'm confused. Could you clarify what you want changed in powerlevel10k?

For sure, let me explain better. I have a font with Powerline glyphs (print '\ue0a0'), but this glyph isn't shown in my prompt when I'm in a git repository.

image

I noticed this glyph in your theme doesn't come from Powerline.

image

So what I'm suggesting is that, instead of showing nothing, how about to show at least this powerline glyph?

romkatv commented 4 years ago

You want to see U+E0A0 in front of Git branch name? Open ~/.p10k.zsh and find this line:

typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=

Set this parameter to '\uE0A0 '.

Does this do what you asked for?

felipecrs commented 4 years ago

Awesome, it does what I asked for. Thank you so much!

The bottom line is: it might be a good idea to have U+E0A0 in front of Git branch name by default when it is available and U+F126 is not (which is the case for Fira Code and Cascadia Code PL -- I suppose the same for most of the Powerline fonts without Nerd Fonts glyphs). What do you think?

romkatv commented 4 years ago

What do you think?

VCS_BRANCH_ICON is purely decorative. It doesn't communicate any information isn't already present in prompt. I don't think it's a good idea to add decorative icons by default, and it doesn't seem worthwhile adding an extra screen to the wizard just to ask whether users want this single icon shown or not.

If you care for decoration, I suggest installing a more capable font. If you like Cascadia, install Cascadia Nerd Fonts.

I noticed this glyph in your theme doesn't come from Powerline.

Why would it? You've told configuration wizard that you terminal can display nerd fonts glyphs, so it's using nerd fonts glyphs.

CalebAnders commented 1 year ago

I'm confused. Could you clarify what you want changed in powerlevel10k?

For sure, let me explain better. I have a font with Powerline glyphs (print '\ue0a0'), but this glyph isn't shown in my prompt when I'm in a git repository.

image

I noticed this glyph in your theme doesn't come from Powerline.

image

So what I'm suggesting is that, instead of showing nothing, how about to show at least this powerline glyph?

I know this is super old, dead by like almost 3 years, BUT in the off chance there was some sort of misunderstanding this whole time...

@felipecrs did you make sure you had FiraCode Nerd Font installed and not just Fira Code font?

I just ran into this same issue that you described where the default Meslo NF font would work and show the nerd font icons for git etc etc however when I switched to Fira Code, they would disappear and running the p10k configure again didn't solve it ofc.

It then occurred to me after reading through this post that the default Fira Code font doesn't have the Nerd Fonts in the font package.

However if you head here: https://www.nerdfonts.com/font-downloads and search for Fira Code download that, then install the fonts, you can then head to your terminal and select Fira Code Nerd Font (or Nerd Font Mono if that's what you want) and bam! The icons come right back, don't even need to run the configuration again (assuming you configured it to look for nerd font icons).

romkatv may have been assuming you were already doing this, and thus the confusion^^

Maybe this is helpful for someone who didn't realize that they needed to very specifically download the nerd font package at least^^

tl;dr -- make sure you actually have the "Nerd Font" specific version of your nerd font font installed 😅

romkatv commented 1 year ago

don't even need to run the configuration again (assuming you configured it to look for nerd font icons)

Always run p10k configure after changing fonts. The presence of Nerd Font glyphs in the font isn't the only thing that the wizard is trying to detect. Things like your font being monospace or not monospace are also important.

felipecrs commented 1 year ago

tl;dr -- make sure you actually have the "Nerd Font" specific version of your nerd font font installed 😅

This issue was never about the glyphs not showing, this was about falling back to Powerline when Nerd Font isn't available. And @romkatv's suggestion stands: all you need is to answer correctly the p10k configure indicating that the Nerd Font glyphs aren't there.

FL0R1AN84 commented 1 year ago

What do you think?

VCS_BRANCH_ICON is purely decorative. It doesn't communicate any information isn't already present in prompt. I don't think it's a good idea to add decorative icons by default, and it doesn't seem worthwhile adding an extra screen to the wizard just to ask whether users want this single icon shown or not.

If you care for decoration, I suggest installing a more capable font. If you like Cascadia, install Cascadia Nerd Fonts.

I noticed this glyph in your theme doesn't come from Powerline.

Why would it? You've told configuration wizard that you terminal can display nerd fonts glyphs, so it's using nerd fonts glyphs.

All you need is here --> https://gist.github.com/davidteren/898f2dcccd42d9f8680ec69a3a5d350e and choose font-fira-code-nerd-font

romkatv commented 1 year ago

Official font docs for a font with a properly sized icons: https://github.com/romkatv/powerlevel10k/blob/master/font.md

felipecrs commented 1 year ago

None of that actually is a solution to the problem stated. The goal was to make p10k display powerline icons when there is no nerd fonts available.

Nevertheless, I no longer care about it anyway. :)

romkatv commented 1 year ago

None of that actually is a solution to the problem stated. The goal was to make p10k display powerline icons when there is no nerd fonts available.

I know, and there is a solution in this issue: run p10k configure and answer the questions about glyph visibility truthfully.

I've posted a link to the recommended font in order to diffuse potential damage done by the preceding comment. It happens all too often that users find bad advice given by other users and then complain about things not working.