安装ohmyzsh

直接输入下面的命令即可

#找到仓库, 然后clone到本地
git clone https://github.com/ohmyzsh/ohmyzsh.git
#把仓库复制到 .oh-my-zsh目录
cp -r ohmyzsh ~/.oh-my-zsh
#复制.zshrc
cp ohmyzsh/templates/zshrc.zsh-template ~/.zshrc
#shell换成zsh
chsh -s /bin/zsh
#删除ohmyzsh
rm -rf ./ohmyzsh

安装相关文件(Powerlevel10k,zsh-syntax-highlighting,zsh-autosuggestions)

  1. 下载powerlevel10k

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
  1. 下载 zsh-autosuggestions

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

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

修改相关配置

修改./zshrc

vim ./zshrc

将主题修改为Powerlevel10k

编辑为 ZSH_THEME="powerlevel10k/powerlevel10k"

ZSH_THEME="powerlevel10k/powerlevel10k"

修改插件

找到 plugins,我们需要把高亮插件和提示插件加上: plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

注意!!!这里的顺序不要改变

其他添加

./zshrc 末尾添加

source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

大功告成,只需要

source ./zshrc

Powerlevel10k配置

相关配置只要根据提示进行即可,此处略去

参考 Mac下iTerm2的安装与配置 Oh My Zsh 主题插件 Powerlevel10k