效果是这样的

###安装homebrew
1
| /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
###安装iTerm2
1
| brew cask install iterm2
|
安装zsh,并切换至zsh
1 2 3
| brew install zsh # 从默认的bash 切换至zsh chsh -s /bin/zsh
|
安装字体
切换到zsh的时候,终端会有乱码,不要怕,换了字体就好了
1 2 3
| brew tap caskroom/fonts #已经迁移至下面链接 brew tap homebrew/cask-fonts brew cask install font-hack-nerd-font
|
终端中修改字体:
iTerm2 -> Preferences -> Profiles -> Text -> Font -> Change Font

Powerlevel9k
1 2 3 4 5
| echo "POWERLEVEL9K_MODE='nerdfont-complete'" >> ~/.zshrc git clone https://github.com/bhilburn/powerlevel9k.git ~/powerlevel9k echo 'source ~/powerlevel9k/powerlevel9k.zsh-theme' >> ~/.zshrc POWERLEVEL9K_MODE='nerdfont-complete' source ~/powerlevel9k/powerlevel9k.zsh-theme
|
最终
1 2 3 4 5
| POWERLEVEL9K_MODE='nerdfont-complete' source ~/powerlevel9k/powerlevel9k.zsh-theme POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh dir vcs newline status) POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
|
主题
主题有很多,我细化 Dracula 主题
echo "alias ls='ls -G'" >> ~/.zshrc
可以在下面下载:
https://iterm2colorschemes.com/
Dracula-download
Dracula


插件
1 2
| brew install zsh-syntax-highlighting brew install zsh-autosuggestions
|
最终zshrc配置文件
cat ~/.zshrc
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| export PATH=$PATH:/usr/local/sbin alias ls='ls -G' alias mtr=/usr/local/sbin/mtr source ~/.bash_profile
POWERLEVEL9K_MODE='nerdfont-complete' source ~/powerlevel9k/powerlevel9k.zsh-theme
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh dir vcs newline status) POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
HOMEBREW_FOLDER="/usr/local/share" source "$HOMEBREW_FOLDER/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" source "$HOMEBREW_FOLDER/zsh-autosuggestions/zsh-autosuggestions.zsh" source "$HOMEBREW_FOLDER/autojump/autojump.zsh"
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
|