如何在Mac上快速安裝oh-my-zsh下的插件zsh-autosuggestion
1、官方資源和github地址信息
2、安裝方法
2.1 mac自帶了zsh,需要更新
brew install zsh zsh-completions
2.2 set up zsh as default(把zsh設置成默認shell)
#設置
chsh -s $(which zsh)
#查檢-需要關閉終端重新打開後生效
echo $SHELL
2.3 安裝 oh my zsh
這裏需要注意zsh是安裝oh my zsh 的Prerequisites(前置條件)
2.3.1 下載oh my zsh到~/.oh-my-zsh
1、通過curl方式安裝:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
2、通過wget方式安裝
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
以上兩個方式都是很慢的安裝方式
這是使用git方式clone下載安裝的,這裏github下載也很慢,有個好辦法,通過gitee安裝
先將github項目導入自己的gitee倉庫-ohmyzsh.git,然後再clone國內倉庫速度飛快,或者你自己重新同步。
git clone https://gitee.com/null_454_5218/ohmyzsh.git ~/.oh-my-zsh
2.3.2 zshrc的配置信息【來自模板】
vi ~/.zshrc
#內容從這個模板來
/Users/honglei/.oh-my-zsh/templates/zshrc.zsh-template
#記得最後
source ~/.zshrc
2.4 安裝 oh my zsh的plugins
2.4.1下載插件到/.oh-my-zsh/custom目錄中
git clone https://gitee.com/null_454_5218/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
2.4.2 配置文件中,添加支持的插件
For example, this might begin to look like this:
plugins=(
git
zsh-autosuggestions
bundler
dotenv
osx
rake
rbenv
ruby
)
2.4.3 使用幫助
As you type commands, you will see a completion offered after the cursor in a muted gray color. This color can be changed by setting the ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE variable. See configuration.
鍵入命令時,您會在光標後看到灰色的靜音形式的補全。 可以通過設置ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE變量來更改此顏色。 請參閱配置。
If you press the → key (forward-char widget) or End (end-of-line widget) with the cursor at the end of the buffer, it will accept the suggestion, replacing the contents of the command line buffer with the suggestion.
如果在光標位於緩衝區末尾的位置按→鍵(前向字符小部件)或End(行尾小部件),它將接受建議,並用建議替換命令行緩衝區的內容。
If you invoke the forward-word widget, it will partially accept the suggestion up to the point that the cursor moves to.
如果您調用前向小部件,它將一直接受建議直到光標移動到的位置。