天天看点

如何让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