如何設置 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

相關文章
相關標籤/搜索