天天看點

如何讓shell支援自動提示

一. 安裝oh-my-zsh

1.第一步 → 把 oh-my-zsh 項目 Clone 下來:

git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh      

2.第二步 → 複制 .zshrc

git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh      

第三步 → 更改你的預設 Shell

git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh      

PS: 檢查是否修改成功,顯示/bin/zsh表示成功

echo $SHELL

二. 安裝oh-my-zsh的自動提示插件zsh-autosuggestion

  1. 下載下傳插件zsh-autosuggestion
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions      
  1. .zhsrc中添加插件
# Add wisely, as too many plugins slow down shell startup.
plugins=(
  git
 zsh-autosuggestions
  #其他插件,下面的插件沒安裝不要添加...
  autojump
  zsh-syntax-highlighting
)      

PS:這個地方一定要注意,要把plugins添加在source之前,不然紫銅提示插件不會生效,找了好久才知道這個原因

如何讓shell支援自動提示
source .zhsrc