如何设置 oh-my-zsh 主题 agnoster

最终效果

步骤

1. 安装该主题须要的字体文件

➜  ~ cd ~
➜  ~ git clone https://github.com/powerline/fonts.git --depth=1
➜  ~ cd fonts
➜  ~ ./install.sh
➜  ~ cd ..
➜  ~ rm -rf fonts

详细说明,点击这里 https://github.com/powerline/fontsgit

2. 修改 zsh 配置

➜  ~ vim ~/.zshrc

# 修改这里切换主题
#ZSH_THEME="robbyrussell"
ZSH_THEME="agnoster"

# agnoster 主题设置:隐藏当前用户
#prompt_context() {
#  DEFAULT_USER="sunqiang"
#}

# agnoster 主题设置:只显示当前用户名
prompt_context() {
  if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
    prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"
  fi
}

3. 修改 iTerm 设置

最后彻底关闭并从新打开 iTerm 生效。github

相关文章
相关标签/搜索