快速安装oh-my-zsh的插件autojump


如何使用autojump:
1.通过命令使用过的目录,可以j+目录直接跳转

2.通过 j -a 目录 命令向数据库添加条目,也是可以直接使用的

通过j --stat 查看可使用的记录

1.什么是autojump

autojump - a faster way to navigate your filesystem
自动跳转-浏览文件系统的更快方法

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
自动跳转是浏览文件系统的一种更快的方法。 它通过维护命令行中最常用的目录的数据库来工作。
必须先访问目录,然后才能跳转到

2.如何安装oh-my-zsh

如何快速安装oh-my-zsh【国内镜像极速】

3.安装 oh my zsh的plugins

3.1 Mac安装方式
brew install autojump

注意,安装好后,仔细看提示的内容
在这里插入图片描述

#安装成功后,编辑配置文件[将下方的命令粘进去]
vi ~/.zshrc
#source 在当前bash环境下读取并执行FileName(zshrc)中的命令
source ~/.zshrc

把autojump添加插件中,然后在后面添加此命令在配置文件中

plugins=(
  git
  zsh-autosuggestions
  autojump
)
[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh

我的配置效果图
在这里插入图片描述

3.2 linux安装方式
#.下载插件autojump到/.oh-my-zsh/custom目录中
git clone https://gitee.com/null_454_5218/autojump.git $ZSH_CUSTOM/plugins/autojump
#.到目录autojump中
cd $ZSH_CUSTOM/plugins/autojump
#执行install.py
./install.py
vi ~/.zshrc
#在配置结尾处或者参考上面处添加此行命令
plugins=(
  git
  zsh-autosuggestions
  autojump
)
[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh

4.autojump的使用帮助&演示

autojump --help

autojump --help
usage: autojump [-h] [-a DIRECTORY] [-i [WEIGHT]] [-d [WEIGHT]] [--complete]
                [--purge] [-s] [-v]
                [DIRECTORY [DIRECTORY ...]]

Automatically jump to directory passed as an argument.

positional arguments:
  DIRECTORY             directory to jump to

optional arguments:
  -h, --help            show this help message and exit
  -a DIRECTORY, --add DIRECTORY
                        add path
  -i [WEIGHT], --increase [WEIGHT]
                        increase current directory weight
  -d [WEIGHT], --decrease [WEIGHT]
                        decrease current directory weight
  --complete            used for tab completion
  --purge               remove non-existent paths from database
  -s, --stat            show database entries and their key weights
  -v, --version         show version information

Please see autojump(1) man pages for full documentation.
4.1 例子说明[只有使用过的目录,才可以直接跳转]

–purge 从数据库删除不存在的路径(remove non-existent paths from database)

#执行j --purge,然后删除了一条无效的数据
j --purge
Purged 1 entries.

j --stat 显示数据库条目及其关键权重(show database entries and their key weights)

只有使用过的目录,才可以直接跳转,或者在数据库条目中的目录,才可以直接用j+目录
在这里插入图片描述
add DIRECTORY 添加目录到数据库
j -a /Users/honglei/Pictures

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

[shenhonglei]

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值