快速安装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
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