zsh安装powerlevel10k样式

安装Nerd Fonts字体

MacOS

方式一:

# https://github.com/ryanoasis/nerd-fonts#option-4-homebrew-fonts
brew tap caskroom/fonts #字體安裝軟體,只需執行一次以後就可以去下載其他字體
brew cask install font-hack-nerd-font # 安裝字體

方式二:

cd ~/Library/Fonts && curl -fLo "Droid Sans Mono for Powerline Nerd Font Complete.otf" https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DroidSansMono/complete/Droid%20Sans%20Mono%20Nerd%20Font%20Complete.otf

客户端设置字体

Iterm2 里配置非 acsii 字体,否则对于 powerlevel10k 主题的特殊字体会显示不出来。

(Iterm2 -> Preferences -> Profiles -> Text -> Non-Ascii-Font 选择 nerd-font and restart Iterm2), 之后重启 Iterm2 生效

Linux

方式一:

git clone https://github.com/ryanoasis/nerd-fonts.git --depth 1
cd nerd-fonts 
./install.sh
cd ..
rm -rf nerd-fonts

安装完后,终端客户端需要选择名字带 nerd fonts 的字体

上述方式非常不友好,完全下载,整个包有1G

方式二:

mkdir -p ~/.local/share/fonts
cd ~/.local/share/fonts && curl -fLo "Droid Sans Mono for Powerline Nerd Font Complete.otf" https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DroidSansMono/complete/Droid%20Sans%20Mono%20Nerd%20Font%20Complete.otf

生成字体信息缓存

fc-cache -vf ~/.local/share/fonts/

查看是否安装成功

fc-list | grep -i droid
/home/kylin/.local/share/fonts/Droid Sans Mono for Powerline Nerd Font Complete.otf: DroidSansMonoForPowerline Nerd Font:style=Book

Windows

方式一:

官网下载直接安装

官网地址

方式二:

使用 Nerd Fonts https://github.com/ryanoasis/nerd-fonts 字体库里面的字体(Powerline Fonts https://github.com/powerline/fonts 字体库里面的字体估计也行,还没试过)。Windows Terminal 默认的字体为 Cascadia Code,在 Nerd Fonts 仓库找到了 Cascadia Code 的打补丁字体 Caskaydia Cove Nerd Font*,下载并安装 Caskaydia Cove Regular Nerd Font Complete Windows Compatible.ttf

Windows 字体相关知识

  • 用户安装的字体都存放在 C:\Users\<用户名>\AppData\Local\Microsoft\Windows\Fonts 目录下,为所有用户安装的字体存放在 C:\Windows\fonts 目录下
  • 字体管理,在『设置 --> 个性化 --> 字体』中可以搜索并卸载字体,等同于在C:\Windows\fonts 目录下搜索并删除字体
  • 注意:在 C:\Users\<用户名>\AppData\Local\Microsoft\Windows\Fonts 目录下删除安装的字体会报错,因为 C:\Windows\fonts 目录下存有 C:\Users\<用户名>\AppData\Local\Microsoft\Windows\Fonts 中的字体引用,所以删除/卸载字体,应去C:\Windows\fonts 目录下执行

客户端设置字体

window-terminal中设置字体:

profiles中设置

"fontFace":"CaskaydiaCove NF",

"fontFace":"Hack Nerd Font Mono",

安装powerlevel10k

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k

p10k configure

修改zsh样式配置

ZSH_THEME="powerlevel10k/powerlevel10k"

source ~/.zshrc

powerlevel10k主题配置

#ZSH_THEME=powerlevel10k/powerlevel10k

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs pyenv)
POWERLEVEL9K_MODE='nerdfont-complete'
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR=''
POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR=''
POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR=''
POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR=''
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="%F{blue}\u256D\u2500%F{white}"
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%F{blue}\u2570\uf460%F{white} "
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(root_indicator dir dir_writable_joined)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(command_execution_time
                                    vcs background_jobs_joined time_joined)
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND="clear"
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND="clear"
POWERLEVEL9K_VCS_MODIFIED_FOREGROUND="yellow"
POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND="yellow"
POWERLEVEL9K_DIR_HOME_BACKGROUND="clear"
POWERLEVEL9K_DIR_HOME_FOREGROUND="blue"
POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND="clear"
POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="blue"
POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_BACKGROUND="clear"
POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_FOREGROUND="red"
POWERLEVEL9K_DIR_DEFAULT_BACKGROUND="clear"
POWERLEVEL9K_DIR_DEFAULT_FOREGROUND="white"
POWERLEVEL9K_ROOT_INDICATOR_BACKGROUND="red"
POWERLEVEL9K_ROOT_INDICATOR_FOREGROUND="white"
POWERLEVEL9K_STATUS_OK_BACKGROUND="clear"
POWERLEVEL9K_STATUS_OK_FOREGROUND="green"
POWERLEVEL9K_STATUS_ERROR_BACKGROUND="clear"
POWERLEVEL9K_STATUS_ERROR_FOREGROUND="red"
POWERLEVEL9K_TIME_BACKGROUND="clear"
POWERLEVEL9K_TIME_FOREGROUND="cyan"
POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND='clear'
POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND='magenta'
POWERLEVEL9K_BACKGROUND_JOBS_BACKGROUND='clear'
POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND='green'

参考

nerd-fonts

Centos7通过oh-my-zsh安装powerlevel9k和powerlevel10k

PegasusWang/linux_config

posted @ 2020-11-24 18:44  hongdada  阅读(7675)  评论(1编辑  收藏  举报