使用的是托管在
github.com
上的zsh-autosuggestions
插件,
地址 https://github.com/tarruda/zsh-autosuggestions
image.png
預(yù)先
- 安裝了
git
- 安裝了
zsh
,
地址https://github.com/tarruda/zsh-autosuggestions
和 http://zhuanlan.zhihu.com/mactalk/19556676
步驟 1. git clone
下載插件源碼
- 通過(guò)命令行下載到了
~/.zsh/zsh-autosuggestions
目錄中,通過(guò)cd
可查看
git clone git://github.com/tarruda/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
步驟2. 打開(kāi)~/.zshrc
進(jìn)行配置
2.1復(fù)制以下代碼
# 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 打開(kāi)命令行工具進(jìn)入~/.zshrc
文件并粘貼2.1
中的代碼
vim ~/.zshrc
- 按
i
進(jìn)入--INSERT--
編輯模式,使用上下左右鍵找個(gè)地方粘貼即可(快捷鍵可用)
2.3 保存退出
ESC 回到正常模式
-
:wq
保存并退出vim
vim的簡(jiǎn)單使用參考:
最后,重新打開(kāi)終端即可看到提示效果
-
灰色即為提示