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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章