Mac下的效率工具autojump

Autojump 自己是这么描述的:

autojump is a faster way to navigate your filesystem. It works by maintaining a database of the directories you use the most from the command line.

通过 history 命令你可以找到最近用过的命令,比如

history | grep “git clone”

通过上述命令就能找到近期 clone 了哪些库,省却了写一堆代码的功夫。autojump 就是通过记录你在 history 中的行为把你访问过的文件夹路径都 cache 下来,当你进行如下操作时:

autojump node

他会直接跳到之前访问的 ~/barretlee/work/tb/node 目录下。他还有一个快捷方式:

j node

我很喜欢这个小工具,让我游荡于文件夹之间不费吹灰之力。

安装:

  • brew install autojump
  • .zshrc 中找到 plugins=,在后面添加
    plugins=(git autojump)
  • 然后继续在上述文件中添加
    [[ -s $(brew –prefix)/etc/profile.d/autojump.sh ]] && . $(brew –prefix)/etc/profile.d/autojump.sh
  • source ~/.zshrc

 

其他高效插件1:
zsh-autosuggestions(命令高亮,正确的命令绿色,不正确的红色) 安装:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

plugins=(git autojump zsh-syntax-highlighting)
其他高效插件2:
zsh-autosuggestions(输入命令时,会给出建议的命令,用向右 →键 补全),安装:
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

plugins=(git autojump zsh-syntax-highlighting zsh-autosuggestions)

Enjoy coding. 🙂