$ cd /long/path/here $ cd ../../../other $ j proj j ターミナルの cd を j に
変更する
(autojump)

macOSの場合、Homebrewでインストールして、

brew install autojump

.zshrcに追加しておけば、自動的によくいく場所を覚えて、
j +アルファ[RET]で飛べます。
一度、cdでアクセスした場所を記録するので、一部の単語でも飛べます。

[[ -s $(brew --prefix)/etc/profile.d/autojump.sh ]] && . $(brew --prefix)/etc/profile.d/autojump.shCode language: JavaScript (javascript)

「Linux(Debian系)の場合は、セキュリティ・権限の都合で、Pythonコードでの手動インストールが必要です1」と書いてありました。

sudo apt install autojump

aptでinstallしたのですが、エラーになりました。

$ autojump
Please source the correct autojump file in your shell's
startup file. For more information, please reinstall autojump
and read the post installation instructions.

そこで、Githubからコードをクローンして、インストールする必要があります。

git clone https://github.com/wting/autojump.gitCode language: PHP (php)

プロジェクトにあるインストールスクリプトの実行結果を見ると、必要なデータがユーザーの.autojumpフォルダに入っているのがわかります。
(アンインストールは、./uninstall.pyがあります)

$ python3 install.py
Installing autojump to /home/chii/.autojump ...
creating directory: /home/chii/.autojump/bin
creating directory: /home/chii/.autojump/share/man/man1
creating directory: /home/chii/.autojump/etc/profile.d
creating directory: /home/chii/.autojump/share/autojump
copying file: ./bin/autojump -> /home/chii/.autojump/bin
copying file: ./bin/autojump_argparse.py -> /home/chii/.autojump/bin
copying file: ./bin/autojump_data.py -> /home/chii/.autojump/bin
copying file: ./bin/autojump_match.py -> /home/chii/.autojump/bin
copying file: ./bin/autojump_utils.py -> /home/chii/.autojump/bin
copying file: ./bin/icon.png -> /home/chii/.autojump/share/autojump
copying file: ./docs/autojump.1 -> /home/chii/.autojump/share/man/man1
creating directory: /home/chii/.autojump/etc/profile.d
creating directory: /home/chii/.autojump/share/autojump
creating directory: /home/chii/.autojump/functions
copying file: ./bin/autojump.sh -> /home/chii/.autojump/etc/profile.d
copying file: ./bin/autojump.bash -> /home/chii/.autojump/share/autojump
copying file: ./bin/autojump.fish -> /home/chii/.autojump/share/autojump
copying file: ./bin/autojump.zsh -> /home/chii/.autojump/share/autojump
copying file: ./bin/_j -> /home/chii/.autojump/functions

Please manually add the following line(s) to ~/.bashrc:

        [[ -s /home/chii/.autojump/etc/profile.d/autojump.sh ]] && source /home/chii/.autojump/etc/profile.d/autojump.sh

Please restart terminal(s) before running autojump.

あとは、自分で.bashrcに起動コマンドを入れます。



[[ -s /home/chii/.autojump/etc/profile.d/autojump.sh ]] && source /home/chii/.autojump/etc/profile.d/autojump.sh
Code language: HTTP (http)

ただ、個人的にはターミナルではなく、EmacsでのIDOやrecentfで移動することが多いので、意識しないと忘れそうです。

  1. All Debian-derived distros require manual activation for policy reasons – wting/autojump: A cd command that learns – easily navigate directories from the command line