直接看效果图
1. 安装 1.1 安装 ohmyzsh https://github.com/ohmyzsh/ohmyzsh
注意安装会覆盖 .zshrc
, 提前备份下
1 sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
.zshrc
文件加下面配置
1 2 export ZSH ="/Users/liuwei/.oh-my-zsh"
重置下配置文件
1 source $ZSH /oh-my-zsh.sh
1.2 安装主题 powerlevel10k https://github.com/romkatv/powerlevel10k
1 2 3 4 git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME /.oh-my-zsh/custom} /themes/powerlevel10k ZSH_THEME="powerlevel10k/powerlevel10k"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 POWERLEVEL9K_MODE='nerdfont-complete' ZSH_THEME="powerlevel10k/powerlevel10k" POWERLEVEL9K_CONTEXT_TEMPLATE='%n' POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND='white' POWERLEVEL9K_PROMPT_ON_NEWLINE=true POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%F{014}\u2570%F{cyan}\uF460%F{073}\uF460%F{109}\uF460%f " POWERLEVEL9K_SHORTEN_DIR_LENGTH=1 POWERLEVEL9K_NODE_VERSION_BACKGROUND="002" POWERLEVEL9K_NODE_VERSION_FOREGROUND="black" POWERLEVEL9K_GO_VERSION_BACKGROUND="001" POWERLEVEL9K_GO_VERSION_FOREGROUND="black" POWERLEVEL9K_WIFI_BACKGROUND="003" POWERLEVEL9K_WIFI_FOREGROUND="black" POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon context ssh dir vcs) POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status proxy anaconda node_version go_version wifi)
1.3 安装字体 下载推荐字体
也可选择其他字体安装
1 2 3 4 https://github.com/powerline/fonts https://github.com/gabrielelana/awesome-terminal-fonts https://github.com/ryanoasis/nerd-fonts/
然后在iterm2里面,把字体改成后缀为powerline的字体就行了
2. 插件 2.1 git 2.2 自动补充 https://github.com/zsh-users/zsh-autosuggestions
1 2 3 4 git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom} /plugins/zsh-autosuggestions plugins=(zsh-autosuggestions)
2.3 语法高亮 https://github.com/zsh-users/zsh-syntax-highlighting
1 2 3 4 git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom} /plugins/zsh-syntax-highlighting plugins=(zsh-syntax-highlighting)
3. 配色 3.1 配色项目 1 2 3 https://github.com/dracula/dracula-theme/ https://github.com/mbadolato/iTerm2-Color-Schemes https://github.com/MartinSeeler/iterm2-material-design
3.2 安装dracula https://github.com/dracula/iterm
1 2 3 4 5 6 7 8 9 git clone https://github.com/dracula/iterm.git iTerm2 > Preferences > Profiles > Colors Tab Open the Color Presets... drop-down in the bottom right corner Select Import... from the list Select the Dracula.itermcolors file Select the Dracula from Color Presets...
4. 遇到的问题 4.1 图案不显示 1 2 POWERLEVEL9K_MODE='nerdfont-complete' source $ZSH /oh-my-zsh.sh
5. 参考资料