1、安装iTerm2

iTerm官网下载,或:

brew install --cask iterm2

2、安装oh-my-zsh

oh-my-zsh阅读相关文档

执行如下脚本进行安装

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

3、安装powerlevel10k主题

cd ~/.oh-my-zsh/themes
git clone https://github.com/romkatv/powerlevel10k.git

vi ~/.zshrc 设置如下内容以使用p10k主题 ZSH_THEME="powerlevel10k/powerlevel10k"

4、安装语法高亮插件和自动补全插件

安装方式与theme大同小异:

cd ~/.oh-my-zsh/custom/plugins/
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
git clone https://github.com/zsh-users/zsh-autosuggestions

下载完插件后退出iterm2

接下来vi ~/.zshrc在插件配置处添加下载的这两个插件名

plugins=(
     git
     zsh-syntax-highlighting
     zsh-autosuggestions
)

另外历史记录时间戳可以改成如下格式

HIST_STAMPS="yyyy-mm-dd"

5、向导模式进行p10k的主题定制

在iTerm2中输入以下代码

p10k configure

定制过程中第一步提示下载字体,然后按照向导根据你喜欢的风格进行主题定制

6、若使用NerdFonts字体

官网下载,并安装