How to install autojump for Fish

Autojump is a tool that can be used to jump around in the shell to frequently used directories by typing just a part of their name. It is typically aliased to j. Autojump is available as a package in the Ubuntu repositories, but that is an old version that does not support the fish shell. Installing the latest version for fish is pretty easy:

  • Clone the autojump repository:
$ git clone https://github.com/wting/autojump.git
  • Install autojump to a local ~/.autojump directory:
$ cd autojump
$ ./install.py
  • Source the autojump.fish file in your fish configuration, by opening the file ~/.config/fish/config.fish in an editor and adding these lines:
begin
    set --local AUTOJUMP_PATH $HOME/.autojump/share/autojump/autojump.fish
    if test -e $AUTOJUMP_PATH
        source $AUTOJUMP_PATH
    end
end
  • Exit the fish shell and start it again. Visit your commonly used directories with the cd command. You can now jump to these directories by using the j command:
$ cd /some/superlongdirectoryname
$ cd
$ j tory
$ pwd
/some/superlongdirectoryname
  • To jump to a child of the current directory:
$ jc some_blah
  • To see statistics of entries in autojump history:
$ j -s
  • According to this page, there is no command to delete a path from the autojump history. You can manually delete the line corresponding to that path in the file ~/.local/share/autojump/autojump.txt

Tried with: Autojump 22.2.4, Fish 2.2b1 and Ubuntu 14.04

Advertisements

3 thoughts on “How to install autojump for Fish”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s