方法一:
按照下列顺序执行指令:
- 来到zsh的插件目录列表
$ZSH_CUSTOM/plugins
-
下载自动补全插件
zsh-autosuggestions
和 高亮插件
zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions.git
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
- 使用vim打开oh-my-zsh的配置文件
vi ~/.zshrc
在配置文件.zshrc中找到以下配置,在git后面(换行)添加下载的插件名称,如下
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
- 执行:
source ~/.zshrc
成功。
方法二
按照官网的推荐指令进行安装:
- 依次执行
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
- 打开.zshrc脚本文件
vi ~/.zshrc
- 在.zshrc末尾添加以下两行命令
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
source ./zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
- 执行:
source ~/.zshrc
成功。
参考:
zsh-autosuggestions install.md
.
zsh-syntax-highlighting install.md
.