zsh-autosuggestions
1.1、zsh-autosuggestions简介

zsh-autosuggestions是一个为zsh提供在敲命令的过程中自动给出建议的插件。

zsh-autosuggestionsGitHub上的网址:https://github.com/zsh-users/zsh-autosuggestions

1.2、在macOS中安装zsh-autosuggestions

1、通过HomeBrew安装:

brew install zsh-autosuggestions

2、在~/.zshrc中添加如下配置:

source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh

3、使配置生效:

source ~/.zshrc
1.3、Oh My Zsh用户安装zsh-autosuggestions

如果您是Oh My Zsh的用户,您可以按照下面的步骤进行安装:

1、通过git下载源代码:

git clone https://github.com/zsh-users/zsh-autosuggestions.git ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions

2、在~/.zshrc中添加如下配置:

plugins=( [plugins...] zsh-autosuggestions)

3、使配置生效:

source ~/.zshrc
1.4、配置zsh-autosuggestions

修改自动提示的文字颜色:

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=6'

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE变量的默认值是fg=8

1.5、如何接受给出的建议

如果给出的建议符合你的需要,那么按向右方向键即可。