Oh My Zsh 方式安裝
zsh-autosuggestions GitHub倉庫地址
- 把插件倉庫克隆到
$ZSH_CUSTOM/plugins
(默認位置是 ~/.oh-my-zsh/custom/plugins)
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
由于GitHub的速度再度抽風,這串命令執行后并沒有克隆成功:
clone失敗截圖
我就去gitee搜了別人克隆好的倉庫,指路:https://search.gitee.com/?skin=rec&type=repository&q=zsh-autosuggestions
git clone https://gitee.com/phpxxo/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
- 設置
~/.zshrc
,把zsh-autosuggestions
添加到 Oh My Zsh 要加載的插件列表中
plugins=(git zsh-autosuggestions)
- 使配置生效
source ~/.zshrc
-
重新打開一個session?,F在就會提示我們執行過的命令啦~~如果提示的是你要的那句命令,按鍵盤的??就可以補全命令了~
還有一個 autojump 插件也非常好使,提升效率杠杠滴
它的用法是輸入 j 目錄名
或 j 目錄名包含的字符
(這個目錄必須是之前 cd 訪問過的),就可直接切換到相應的目錄。不用再各種cd
啦~具體看下面截圖示例。
autojump GitHub倉庫地址
autojump使用示例
手動安裝
git clone git://github.com/wting/autojump.git
cd autojump
./install.py
然后在~/.zshrc 里加上如下語句再source ~/.zshrc
即可生效
[[ -s /Users/xxxxxx/.autojump/etc/profile.d/autojump.sh ]] && source /Users/xxxxxx/.autojump/etc/profile.d/autojump.sh
注意??:這個步驟在執行安裝后自動會提示,xxxxxx指代你的用戶名,到時候直接復制整句即可。
(若要卸載)
cd autojump
./uninstall.py
再來一個高亮顯示常用命令的插件 zsh-syntax-highlighting
- 克隆安裝
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
- 在
~/.zshrc
,把zsh-syntax-highlighting
添加到 Oh My Zsh 的插件列表中
plugins=( [plugins...] zsh-syntax-highlighting)
- 使配置生效
source ~/.zshrc
效果