效果如图:
下载并安装 Powerline 字体
git clone https://github.com/bhilburn/powerlevel9k.git ~/powerlevel9k
git clone https://github.com/powerline/fonts.git ~/fonts
~/fonts/install.sh
中文字体下载这个,并请自行安装
https://github.com/Magnetic2014/YaHei-Consolas-Hybrid-For-Powerline
配置
我用了 yadr dotfile,因此需要添加一个 ~/.yadr/zsh/private.zsh
,也直接可以改 ~/.zshrc
source ~/powerlevel9k/powerlevel9k.zsh-theme
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(time context dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status rbenv)
POWERLEVEL9K_STATUS_VERBOSE=false
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_middle"
POWERLEVEL9K_SHORTEN_DIR_LENGTH=3
iTerm 设置
选择一个英文 Powerline 字体
Preferences -> profiles -> Text -> Change Font
Use Different font for non-ASCII text 打勾
选择上面的YaHei字体