bash 为 zsh + Prezto 主题安装电力线字体
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33238864/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Installing powerline fonts for zsh + Prezto theme
提问by Cole Bittel
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 paradoxtheme!
我目前正在使用 Zsh + Prezto 进行脚本外壳配置。我一直在使用这个sorin
主题,但对它有点不满意。我想切换到悖论主题!
It is supposed to look like this:
它应该是这样的:
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:
我在这样做时遇到了一些麻烦。当我切换到主题时,符号无法加载,因此我收到如下提示:
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).
请注意带框的问号,那里应该有背景的边缘边框或 git 分支的分支符号。(看看这里的paradox
主题预览)。
I've seen herethat I should install Powerline patched fontsfor 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.
我在这里看到我应该为符号安装Powerline 修补字体以正确加载。然而,由于我对这个过程有些陌生,我希望能得到一些帮助,将它安装到我的 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.
在文档中,它指出我应该通过pip
. 当我运行时pip install --user powerline-status
,我的提示仍然无法以它应有的方式显示符号。
What else must I do, after running the installation, to display this prompt correctly?
运行安装后,我还必须做什么才能正确显示此提示?
I am using a MacBook Pro with El Capitan
我正在使用带有 El Capitan 的 MacBook Pro
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:
更新:我已经安装了 powerline 字体并运行 install.sh exec,更改了我的终端首选字体,并测试了提示的新外观。符号现在显示,但是,它们从提示行的基线升高,如下所示:
Notice that the symbol of "\ue0b0" is elevated from the bottom of the row.
请注意,“\ue0b0”的符号从行的底部升高。
回答by haiLong
It is all about the Powerline symbols.
这都是关于电力线符号的。
To get the Powerline symbols working as [email protected]
has:
要使电力线符号按原样[email protected]
工作:
Download a Powerline font. A good font for downloading can be found at https://github.com/powerline/fonts
Install it by running
./install.sh
.Change the font in your Terminal preferences to use the new Powerlinefont.
下载电力线字体。可以在https://github.com/powerline/fonts找到一个很好的下载字体
通过运行安装它
./install.sh
。更改终端首选项中的字体以使用新的Powerline字体。
- Test! To test the glyphs in a terminal:
echo "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699"
- 测试!要在终端中测试字形:
echo "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699"
The prior instructions were intended for Mac OS version 10.11 with Terminal, but may work similar for other setups.
先前的说明适用于带有终端的 Mac OS 10.11 版,但可能适用于其他设置。
回答by Donskikh Andrei
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!
在 Windows 上 - 只需 * 下载一些 Powerline 字体,例如:https:
//github.com/abertsch/Menlo-for-Powerline/raw/master/Menlo%20for%20Powerline.ttf
* 通过单击文件两次来安装它
* 选择新的属性中
的字体就是这样!
回答by rjb
If you're a macOS user, the Powerline glyphs are now built-into iTerm(as of 3.3.7, 17 Nov 2019) but disabled by default.
如果你是一个Mac系统用户,电力线雕文现在内置到的iTerm(截至3.3.7,2019年11月17日)禁止,但在默认情况下。
You can enable the fonts by toggling the checkbox in iTerm > Preferences > Profiles > Text:
您可以通过在 iTerm > Preferences > Profiles > Text 中切换复选框来启用字体:
Any newly opened Terminal windows will render supported Unicode characters as glyphs, as shown the following screenshot test.
任何新打开的终端窗口都会将支持的 Unicode 字符呈现为字形,如下面的屏幕截图测试所示。
$ echo "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699"
If you'd rather manually manage the installation of the Powerline Symbols, you can use Homebrew Casks:
如果您更愿意手动管理 Powerline Symbols 的安装,您可以使用 Homebrew Caks:
$ brew tap homebrew/cask-fonts
$ brew cask install font-powerline-symbols
This will install the PowerlineSymbols.otftypeface for you to use system-wide.
这将安装PowerlineSymbols.otf字体供您在系统范围内使用。
回答by MJeremy
Add on, I am using Hyper
and zsh
and encountered same problem, solved by editing
补充一下,我正在使用Hyper
和zsh
遇到同样的问题,通过编辑解决
fontFamily: 'Menlo, "DejaVu Sans Mono for Powerline", Consolas, "Lucida Console", monospace',
Just adding the font for powerlineinto fontFamily
.
只需将powerline的字体添加到fontFamily
.
回答by vtnate
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.
对于稍后要讨论的任何人,iTerm2 3.3.7 有一个复选框到use built-in Powerline glyphs
. 如果您不想太花哨,这是获得这些字形的简单方法。
Preferences > Profiles > Text > Check that box
首选项 > 配置文件 > 文本 > 选中该框