bashでautojumpを使う
zshだとautojumpよりz.shのほうがPythonなしで動いて良いよ | この先生きのこるにはで紹介されているようにz.shを使ってみるのも良さそうだけど、bashで使いたいのでautojumpを使ってみる。
インストール
$ git clone git://github.com/joelthelion/autojump.git
gitから取得後、autojumpのディレクトリに移動し
$ cd autojump
インストール用のshellを実行する。
$ ./install.sh -l
以下の様な実行結果が表示される。
Installating autojump... Destination: /home/tenten0213/.autojump/ Binary: /home/tenten0213/.autojump/bin/ Documentation: /home/tenten0213/.autojump/share/man/man1/ Icon: /home/tenten0213/.autojump/share/autojump/ Shell scripts: /home/tenten0213/.autojump/etc/profile.d/ `./bin/icon.png' -> `/home/tenten0213/.autojump/share/autojump/icon.png' `./bin/autojump' -> `/home/tenten0213/.autojump/bin/autojump' `./bin/autojump_argparse.py' -> `/home/tenten0213/.autojump/bin/autojump_argparse.py' `./docs/autojump.1' -> `/home/tenten0213/.autojump/share/man/man1/autojump.1' `./bin/autojump.sh' -> `/home/tenten0213/.autojump/etc/profile.d/autojump.sh' `./bin/autojump.bash' -> `/home/tenten0213/.autojump/etc/profile.d/autojump.bash' `./bin/autojump.zsh' -> `/home/tenten0213/.autojump/etc/profile.d/autojump.zsh' `./bin/_j' -> `/home/tenten0213/.autojump/_j' Please add the line to ~/.bashrc : [[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh You need to run 'source ~/.bashrc' before you can start using autojump. To remove autojump, run './uninstall.sh'
以下の1行を.bashrcに追記しろと書かれているので、追記する。
[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh
追記後、bashrcを読み込み直す。
$ source ~/.bashrc
これでインストール完了。
使ってみる
詳細はjoelthelion/autojump · GitHub参照。
とりあえず、あんまりオプションとか使わないで $ j hoge + Tabって感じで使ってる。
$ j hoge
と入力し、Tabを押すと、
$ j '/home/tenten0213/project/hoge'
といった感じで補完してくれる。
うん、便利。