您当前的位置: 首页 >  macos

liaowenxiong

暂无认证

  • 2浏览

    0关注

    1171博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

MacOS在zsh环境下安装和使用终端插件autojump

liaowenxiong 发布时间:2021-10-30 00:07:17 ,浏览量:2

文章目录
  • 介绍
  • 安装 autojump
    • 使用 git clone
    • 使用 HomeBrew 安装
  • 配置
  • 使用 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. Directories must be visited first before they can be jumped to.

关于 autojump 有以下几个站点: https://github.com/wting/autojump https://github.com/haoziyeung/autojump https://gitee.com/gentlecp/autojump/ https://www.worldlink.com.cn/en/osdir/autojump.html

注:autojump 不仅可以用在 zsh 环境下,也可以在 bash 环境下使用。

安装 autojump 使用 git clone
cd ~/.oh-my-zsh/custom/plugins/ 
git clone git://github.com/wting/autojump.git
cd autojump
./install.py 
使用 HomeBrew 安装
brew install autojump

注:默认安装到 ~/.oh-my-zsh/plugins/ 目录下。

配置

安装好之后,必须在 ~/.zshrc 文件里的 plugins 添加如下内容: 在这里插入图片描述 在文件末尾加上如下语句:

[[ -s $(brew --prefix)/etc/profile.d/autojump.sh ]] && . $(brew --prefix)/etc/profile.d/autojump.sh

配置好之后执行下面命令,立即生效:

source ~/.zshrc
使用 autojump

autojump 用法是输入 j 目录名j 目录名中的部分字符 就可以直接切换到相应的目录,不用再各种 cd 啦。

特别注意:切换的目录必须是之前 cd 访问过的才可直接切换。

举例说明如下:

cd /Users/liaowenxiong/desktop # 切换到桌面目录下
cd ~ # 切换到用户主目录下
j desk # 此时在用户主目录下,可以直接切换到 /Users/liaowenxiong/desktop
j liaowenxiong # 无法切换,因为之前没有 cd /Users/liaowenxiong/
卸载 autojump
cd ~/.oh-my-zsh/custom/plugins/
cd autojump
./uninstall.py
关注
打赏
1661566967
查看更多评论
立即登录/注册

微信扫码登录

0.0386s