1.安装更新zsh
brew install zsh
2.确保有zsh的情况下 安装oh my zsh
sh-c"$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
3.安装插件zsh-autosuggestions:输入命令时可提示自动补全
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
安装插件zsh-syntax-highlighting:日常用的命令会高亮显示,命令错误显示红色
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
然后编辑vim ~/.zshrc文件,找到plugins配置,增加zsh-autosuggestions插件。默认是 plugins=(git),如果里面有多个可以用空格分开
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
然后执行 source ~/.zshrc 就可以了。