jump
- navigate faster by learning your habits
j [term ...]
Jump integrates with the shell and learns about your navigational habits by keeping track of the directories you visit. It strives to give you the best directory for the shortest search term.
Jump needs to be integrated with the shell. For bash
and zsh
, the the line
below in needs to be in ~/.bashrc
, ~/bash_profile
or ~/.zshrc
:
eval "$(jump shell)"
For fish shell, put the line below needs to be in ~/.config/fish/config.fish
:
status --is-interactive; and . (jump shell | psub)
Once integrated, jump will automatically directory changes and start building an internal database.
Once integrated, jump introduces the j helper. It accepts only search terms and as a design goal there are no arguments to j. Whatever you give it, it's treated as search term.
Jump uses fuzzy matching to find the desired directory to jump to. This means that your search terms are patterns that match the desired directory approximately rather than exactly. Typing 2 to 5 consecutive characters of the base directory names is all that jump needs to find it.
The default search behavior of jump is to case insensitively match only the base directory path of the scored directories. This is because absolute paths are long and short search terms can fuzzy match them easily, lead to bad matches.
If you visit the directory /Users/genadi/Development/rails/web-console
often,
you can jump to it by:
$ j wc # or...
$ j webc # or...
$ j console # or...
$ j b-c # or...
Of course, web-console
can be typed directly as a search term:
$ j web-console
$ pwd
/Users/genadi/Development/rails/web-console
Using jump is all about saving key strokes. However, if you made the effort to type a directory base name exactly, jump will try to find the exact match, rather than fuzzy search.
Given the following directories:
/Users/genadi/Development/society/website
/Users/genadi/Development/chaos/website
Can you be sure where j web
will lead you? You can hint jump where you want
to go. To ensure a match of /Users/genadi/Development/chaos/website
, use the
search term:
$ j ch web
$ pwd
/Users/genadi/Development/chaos/website
This instructs jump to look for a web
match inside that is preceded by a
ch
match in the parent directory. The search is normalized only on the last
two parts of the target paths. This will ensure a better match, because of the
shorter path to fuzzy match on.
There are no depth limitations though and a jump to
/Users/genadi/Development/society/website
can look like:
$ j dev soc web
$ pwd
/Users/genadi/Development/society/website
In fact, every spaces passed to j
are converted to OS separators. The search
term above can be expressed as:
$ j dev/soc/web
$ pwd
/Users/genadi/Development/society/website
Sometimes bad jumps happen. Maybe the search has a better scored directory
already. If we want to jump to /Users/genadi/Development/hack/website
and we
have the following entries in the database:
/Users/genadi/Development/society/website
/Users/genadi/Development/chaos/website
/Users/genadi/Development/hack/website
Typing j web
would lead to:
$ j web
$ pwd
/Users/genadi/Development/society/website
Instead of typing another search term, typing j without a search term will instruct jump to the second best, third best and so on matches.
$ j
$ pwd
/Users/genadi/Development/chaos/website
$ j
$ pwd
/Users/genadi/Development/hack/website
To trigger a case-sensitive search, use a term that has a capital letter.
$ j Dev
$ pwd
/Users/genadi/Development
The jump will resolve to /Users/genadi/Development
even if there is
/Users/genadi/Development/dev-tools
that scores better.
The MIT License (MIT)
Copyright (c) 2015-2018 Genadi Samokovarov
autojump(1), z(1), pushd(1), popd(1)