Jump, a bookmarking system for the bash and zsh shells.¶ ↑
Introduction¶ ↑
Jump is a tool that allows you to quickly change directories in the bash and zsh shells using bookmarks. Thanks to Jump, you won’t have to type those long paths anymore. Jump was inspired by go-tool by ActiveState.
Usage¶ ↑
Say you often work in a directory with a path like ‘/Users/giuseppe/Work/Projects/MyProject`. With Jump you can add a bookmark to it:
$ jump --add myproject
From now on you can jump to your project just by typing:
$ jump myproject
You can even append subfolders to the bookmark name!
$ jump myproject/src/
You can take a look at all your bookmarks with the ‘list` command:
$ jump --list
To delete a bookmark you don’t need anymore, use the ‘del` command:
$ jump --del myproject
To show the path to a bookmark, use the ‘path` command:
$ jump --path myproject
Don’t remember a command? Just type:
$ jump --help
Advanced completion¶ ↑
Suppose you added a bookmark called rails-app pointing to /home/flavio/test/test_app. The folder contains the following files:
drwxr-xr-x 6 flavio users 4096 2010-08-10 10:38 app drwxr-xr-x 5 flavio users 4096 2010-08-10 10:38 config drwxr-xr-x 2 flavio users 4096 2010-08-10 10:38 db drwxr-xr-x 2 flavio users 4096 2010-08-10 10:38 doc drwxr-xr-x 3 flavio users 4096 2010-08-10 10:38 lib drwxr-xr-x 2 flavio users 4096 2010-08-10 10:38 log drwxr-xr-x 5 flavio users 4096 2010-08-10 10:38 public -rw-r--r-- 1 flavio users 307 2010-08-10 10:38 Rakefile -rw-r--r-- 1 flavio users 10011 2010-08-10 10:38 README drwxr-xr-x 3 flavio users 4096 2010-08-10 10:38 script drwxr-xr-x 7 flavio users 4096 2010-08-10 10:38 test drwxr-xr-x 6 flavio users 4096 2010-08-10 10:38 tmp drwxr-xr-x 3 flavio users 4096 2010-08-10 10:38 vendor
The following completions are available:
$ jump ra[TAB]
is expanded to:
$ jump rails-app
While
$ jump rails-app/[TAB]
allows to choose between the following completions:
rails-app/ rails-app/config rails-app/doc rails-app/log rails-app/script rails-app/tmp rails-app/app rails-app/db rails-app/lib rails-app/public rails-app/test rails-app/vendor
Typing
$ jump rails-app/l[TAB]
suggests the following completions:
rails-app/lib rails-app/log
Hence
$ jump rails-app/lo[TAB]
is automatically expanded to
$ rails-app/log
jump also allows users to print out the path of a bookmark. This adds a flavor of new commands in conjunction to jump. For example, jump allows a user to execute the following commands:
$ ls `jump -p rails-app` $ cp `jump -p rails-app/Rakefile` . $ vim `jump -p rails-app/README`
The advanced completion works out of the box for zsh users. The bash shell relies on bash_completion.
Installation¶ ↑
Jump is packaged as a gem:
$ gem install jump
Notes for Debian & Ubuntu users¶ ↑
The rubygem package shipped with Debian & Ubuntu acts in a different way. Once jump has been installed you have to updated your PATH (unless you have already done it).
Execute the following command:
$ gem environment
and take a look at the GEM PATHS section.
You will have something like that:
- GEM PATHS: - /var/lib/gems/1.8
In this case /var/lib/gems/1.8 is your GEM PATH. Add GEM PATH/bin to your PATH.
Later versions of Debian/Ubuntu don’t have a bin/ directory under the gems directory, so you should add the explicit jump gem directory to your path, ie:
/var/lib/gems/2.3.0/gems/jump-0.4.1/bin
Additonally you’ll want to run the following within the bin/ directory so you can run jump instead of jump-bin
$ cp jump-bin jump
Bash integration¶ ↑
Using bash-completion (recommended)¶ ↑
It’s strongly recommended to install bash_completion. In this way you will have the best user experience.
Linux users can install it using their package manager (apt, zypper, yum, emerge…) while OSX users can install it via ports, fink or brew.
Execute the following command once jump has been installed:
sudo cp `jump-bin --bash-integration`/bash_completion/jump /path_to/bash_completion.d
The bash_completion.d directory is usually located under /etc/. OSX users will find this directory under fink/port/brew installation directory (e.g. /opt/local/etc).
Note for Ubuntu users: the gem contents jump
command won’t show the absolute installation path.
All the files shipped with jump can be found under the following path:
[GEM PATH]/gems/jump-[JUMP VERSION]/
Take a look at the previous section in order to figure out your GEM PATH.
Without bash-completion¶ ↑
If you do not want to install bash_completion then add the following code to your bash configuration file (e.g. ~/.bash_profile or ~/.bashrc’:
source `jump-bin --bash-integration`/shell_driver
Beware: without bash_completion you won’t be able use jump’s advanced completion features.
Zsh integration¶ ↑
After having installed jump, add the following code to your .zshrc file:
source `jump-bin --zsh-integration`
© 2010 Flavio Castelli and Giuseppe Capizzi