MENU

oh-my-zsh插件推荐 : autojump、zsh-autosuggestion以及zsh-syntax-highlighting

February 16, 2019 • 资源教程

  • 本篇文章介绍了oh-my-zsh下三个插件autojump、zsh-autosuggestion和zsh-syntax-highlighting以及它们的安装教程
  • 承接上一篇Mac、Linux 安装zsh & oh-my-zsh

先在配置文件.zshrc 的plugins中添加添加插件(可灵活更改),三个插件安装完后再用source ~/.zshrc更新配置文件使更改生效

autojump

效果
实现目录间快速跳转,想去哪个目录直接j + 目录名,不用在频繁的cd了! ::quyin:die::

安装
Mac系统

$ brew install autojump

如果你是linux系统

$ git clone git://github.com/joelthelion/autojump.git

cd /autojump,执行

$ ./install.py

vim ~/.zshrc,把以下代码加到尾部

# 使用brew安装的

[[ -s $(brew --prefix)/etc/profile.d/autojump.sh ]] && . $(brew --prefix)/etc/profile.d/autojump.sh
source $ZSH/oh-my-zsh.sh

# 使用git安装的

[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh

zsh-autosuggestion

效果
如图所示,输入命令时可提示自动补全(灰色部分),然后按键盘 → 即可补全(详细介绍

安装

$ git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

zsh-syntax-highlighting

效果
日常用的命令会高亮显示,命令错误显示红色,如下图(详细介绍

安装

$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

最后用 source ~/.zshrc 命令更新配置文件,重启终端即可使用,来面对你船新的zsh吧! ::quyin:feizao::

Leave a Comment

21 Comments
  1. 崔先森 崔先森     Ubuntu /    Google Chrome

    恩,最近突然喜欢上zsh,不错~
    只好比默认的terminal好看一些.
    autojump?额,刚才搜了下确实有,试试效果~

    1. 左岸 左岸     Windows 10 /    Google Chrome

      @崔先森嗯用Linux的大部分在用zsh的OωO,autojump挺方便的,试一下吧 ::quyin:feizao::

  2. 枂下 枂下     Windows 7 /    Google Chrome

    元宵节快乐,前排吃瓜

    1. 左岸 左岸     MacOS /    Google Chrome

      @枂下老哥同乐!୧(๑•̀⌄•́๑)૭