Installing powerline fonts for zsh + Prezto theme
Asked Answered
C

6

14

I am currently using Zsh + Prezto for my scripting shell configuration. I have been using the sorin theme but am a little dissatisfied with it. I'd like to switch to the paradox theme!

It is supposed to look like this:

Blockquote

I'm having some trouble doing that. When I switch to the theme, the symbols aren't able to load, so I get a prompt that looks like this:

Blockquote

Notice the boxed question marks where there should be an edge border for the background or a branch symbol for the git branch. (Take a look at the paradox theme preview here).

I've seen here that I should install Powerline patched fonts for the symbols to load in correctly. However, as I'm somewhat unfamiliar with the process, I would love some help installing it into my OS X.

In the documentation, it notes I should install via pip. When I run pip install --user powerline-status, my prompt is still unable to display the symbols the way it should look.

What else must I do, after running the installation, to display this prompt correctly?

I am using a MacBook Pro with El Capitan


Update: I have installed the powerline fonts and run the install.sh exec, changed my terminal preferred font, and tested out the new look of the prompt. The symbols now display, however, they are raised from the baseline of the prompt row, like so:

enter image description here

Notice that the symbol of "\ue0b0" is elevated from the bottom of the row.

Challis answered 20/10, 2015 at 14:3 Comment(9)
You don't really have to use "Powerline patched fonts". You just need some fonts (even multiple ones will do) that support the relevant glyphs. I don't know what kind of font backend you're using, since you're contradicting yourself: "I would love some help installing it into my Linux machine", then "I am using a MacBook Pro with El Capitan"... On OS X installing fonts is a no brainer with FontBook (it's not great, I know). On Linux, suppose your backend is fontconfig, you just need to put your font files in one of the directories scanned by fc-cache, then run fc-cache.Wollis
See /usr/share/doc/fontconfig/fontconfig-user.html.Wollis
On OS X another easy way to install free fonts is to use homebrew-cask. See https://github.com/caskroom/homebrew-fonts. For instance, you can use brew cask install font-droid-sans-mono to install Droid Sans Mono, which seems to be rather popular (although I'm personally a hardcore 10pt Monaco fan).Wollis
Question corrected to remove contradiction (thanks!). If I just use the FontBook, what really needs to be done? Do I change a System Preference or do I change iTerm's preferences? Do you suggest against the Powerline patched fonts in the question?Challis
Download the TrueType or OpenType font files (.ttf, .otf) and simply open them (they are bound to FontBook by default). Alternatively you put the font files in $HOME/Library/Fonts and be done with it. Set typeface in Preferences->Profiles->Text (for iTerm2). Now that I look at the project more closely, I do see an install.sh that covers most of what I said.Wollis
"Do you suggest against..." No, I'm just saying they're not magical; they include the necessary glyphs, that's all. Maybe Droid Sans Mono etc. don't have the funny-looking crossroad symbol? I don't know, and didn't bother to test. I'm perfectly happy with ASCII myself.Wollis
By the way, that install.sh is rather hilarious... if [[ -n `which fc-cache` ]]; then... Don't try to learn shell scripting from it.Wollis
Still having issues getting the symbols to work correctly. I've downloaded and installed droid-sans-mono and am using that as my font in iTerm (both Regular and Non-ASCII). However, after restarting iTerm, I'm still not getting the display prompt to display correctly.Challis
Did you download the "patched" one? Also, please post the new screenshot along with a screenshot of the preferences screen I mentioned.Wollis
T
29

It is all about the Powerline symbols.

To get the Powerline symbols working as [email protected] has:

  1. Download a Powerline font. A good font for downloading can be found at https://github.com/powerline/fonts

  2. Install it by running ./install.sh.

  3. Change the font in your Terminal preferences to use the new Powerline font.

enter image description here

  1. Test! To test the glyphs in a terminal: echo "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699"

enter image description here

The prior instructions were intended for Mac OS version 10.11 with Terminal, but may work similar for other setups.

Tenderfoot answered 22/10, 2015 at 7:9 Comment(3)
Great answer! Do you have any idea why this I'm getting raised symbols? I have modified the question to show my newest problem.Challis
Also is the Font problem,influence of the font size and line spacing. Change the "Line Spacing"Tenderfoot
Make sure you set the 'non ascii font' too, otherwise not all of the glyphs will work. iTerm will update the existing output from echo (as per screenshot above) as you change the font, so just search in the font dialog for 'powerline' and then walk through each one until you have one that works.Solvolysis
F
3

If you're a macOS user, the Powerline glyphs are now built-in to iTerm (as of 3.3.7, 17 Nov 2019) but disabled by default.

You can enable the fonts by toggling the checkbox in iTerm > Preferences > Profiles > Text:

iTerm2 Preferences Showing Powerline Fonts Checkbox Option

Any newly opened Terminal windows will render supported Unicode characters as glyphs, as shown the following screenshot test.

$ echo "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699"

Screenshot of iTerm Window with Powerline Symbols font


If you'd rather manually manage the installation of the Powerline Symbols, you can use Homebrew Casks:

$ brew tap homebrew/cask-fonts

$ brew cask install font-powerline-symbols

This will install the PowerlineSymbols.otf typeface for you to use system-wide.

Forerunner answered 3/2, 2020 at 18:32 Comment(0)
L
2

On Windows - just * download some Powerline font like: https://github.com/abertsch/Menlo-for-Powerline/raw/master/Menlo%20for%20Powerline.ttf
* Install it by clicking the file twice
* Choose the new font in properties
That's it!

Loredo answered 16/10, 2017 at 13:27 Comment(0)
S
0

Add on, I am using Hyper and zsh and encountered same problem, solved by editing

fontFamily: 'Menlo, "DejaVu Sans Mono for Powerline", Consolas, "Lucida Console", monospace',

Just adding the font for powerline into fontFamily.

Sumter answered 3/4, 2019 at 6:7 Comment(0)
C
0

For anyone coming to this later, iTerm2 3.3.7 has a checkbox to use built-in Powerline glyphs. If you're not trying to get too fancy, this is an easy way to get those glyphs.

Preferences > Profiles > Text > Check that box

Clifton answered 31/1, 2020 at 4:57 Comment(0)
C
0

For Linux people that have to work in a local environment (i.e. without sudo access), here is the procedure:

cd <cloning_path>
git clone https://github.com/powerline/fonts-git --depth=1
cd fonts
./install.sh

That's it. You don't have to configure anything in a graphical menu like other answers say. Powerline fonts should be loaded and powerline symbols should automatically be used by the oh my zsh prompt

If you later want to un install the powerline fonts:

cd <cloning_path>/fonts
./uninstall.sh
Converted answered 5/12, 2021 at 21:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.