使用的是托管在
github.com上的zsh-autosuggestions插件,
地址 https://github.com/tarruda/zsh-autosuggestions

image.png
预先
- 安装了
git - 安装了
zsh,
地址https://github.com/tarruda/zsh-autosuggestions
和 http://zhuanlan.zhihu.com/mactalk/19556676
步骤 1. git clone下载插件源码
- 通过命令行下载到了
~/.zsh/zsh-autosuggestions目录中,通过cd可查看
git clone git://github.com/tarruda/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
步骤2. 打开~/.zshrc进行配置
2.1复制以下代码
# Load zsh-syntax-highlighting.
source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Load zsh-autosuggestions.
source ~/.zsh/zsh-autosuggestions/autosuggestions.zsh
# Enable autosuggestions automatically.
zle-line-init() {
zle autosuggest-start
}
zle -N zle-line-init
2.2 打开命令行工具进入~/.zshrc文件并粘贴2.1中的代码
vim ~/.zshrc- 按
i进入--INSERT--编辑模式,使用上下左右键找个地方粘贴即可(快捷键可用)
2.3 保存退出
ESC 回到正常模式-
:wq保存并退出vim vim的简单使用参考:
最后,重新打开终端即可看到提示效果
-
灰色即为提示