安装oh-my-zsh的插件zsh-autosuggestions 和zsh-syntax-highlighting的正确方式

  • Post author:
  • Post category:其他




方法一:

按照下列顺序执行指令:

  1. 来到zsh的插件目录列表


$ZSH_CUSTOM/plugins

  1. 下载自动补全插件

    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

  1. 使用vim打开oh-my-zsh的配置文件


vi ~/.zshrc

在配置文件.zshrc中找到以下配置,在git后面(换行)添加下载的插件名称,如下

plugins=(
  		git
  		zsh-autosuggestions 
 	 	zsh-syntax-highlighting
	)
  1. 执行:


source ~/.zshrc

成功。



方法二

按照官网的推荐指令进行安装:

  1. 依次执行


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

  1. 打开.zshrc脚本文件


vi ~/.zshrc

  1. 在.zshrc末尾添加以下两行命令
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
source ./zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  1. 执行:


source ~/.zshrc

成功。

参考:


zsh-autosuggestions install.md

.


zsh-syntax-highlighting install.md

.



版权声明:本文为llq886原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。