Go to file
Grégory Soutadé ca2becd321 Add alias command to installation instructions 2012-12-24 09:12:45 +01:00
COPYING Initial commit 2012-01-23 16:31:04 +01:00
README Add alias command to installation instructions 2012-12-24 09:12:45 +01:00
autojump2 Initial commit 2012-01-23 16:31:04 +01:00
autojump2.bash Initial commit 2012-01-23 16:31:04 +01:00

README

INTRODUCTION

Autojump2 is a fork of Autojump originaly written by Joel Schaerer (https://github.com/joelthelion/autojump).
The philosophy is different from Autojump. Autojump use "j" command and increment a number after each call. 
In opposite, Autojump2 is a replacement of "cd" command. "cd" behaviour is enhanced by intelligent completion and
short links to your favorite directories.
* Personal opinion *
Another thing is that the code is simpler than Autojump2, completion is smarter, database management is better.

Regular expressions.
Autojump2 use two regular expressions constructed with arguments, "cd a b c" is translated in :
-  .*/.*a.*b.*c.*          # All arguments define last directory name
-  .*/.*a.*/.*b.*/.*c.*    # Arguments are part of path
So you can address complex paths with multiple arguments.


LICENCE

Autojump2 (like autojump) is under GPL version 3 licence.


INSTALLATION

No script is delivered because installation is simple.

Local installation :
- Copy whole package content in ~/.local/share/autojump2
- Create a symbolic link from a bin directory (/bin, /usr/bin, ...) to ~/.local/share/autojump2/autojump2
- Add 'source ~/.local/share/autojump2/autojump2.bash' to your ~/.bashrc
- Add 'alias cd="j"' to your ~/.bashrc

Bin installation
- Copy whole package content in /usr/local/share/autojump2
- Create a symbolic link from a bin directory (/bin, /usr/bin, ...) to /usr/local/share/autojump2/autojump2
- Add 'source /usr/local/share/autojump2/autojump2.bash' to your ~/.bashrc
- Add 'alias cd="j"' to your ~/.bashrc

A database named .autojump2.dict will be created at $AUTOJUMP2_DATA_DIR/ or ~/ if variable is not defined


USAGE

Example directory hierarchy :
proj
 |--- v1/
 |--- v2/
 |--- v3/
 |--- branch/
       |--- v2/


First, add your favorite directories to autojump2 database :

cd --add proj/v2
>>> '/home/soutade/proj/v2' correctly added to database
cd -a proj/v1
>>> '/home/soutade/proj/v1' correctly added to database
cd -a proj/\\*
>>> '/home/soutade/proj/*' correctly added to database
cd --add proj/branch/v2
>>> '/home/soutade/proj/branch/v2' correctly added to database

If you specify a star in pathname, the directory will be recursively walked
to find directories. You can specify more than one star.

List database :

cd --list
/home/soutade/proj/v1
/home/soutade/proj/v2
/home/soutade/proj/branch/v2
/home/soutade/proj/*
>>> /home/soutade/proj/v1
>>> /home/soutade/proj/v2
>>> /home/soutade/proj/v3


Try to jump to v2 and to v1 :

cd v2
/home/soutade/proj/v2

cd v[tab][tab]
v__1__/home/soutade/proj/v1
v__2__/home/soutade/proj/v2
v__3__/home/soutade/proj/v3
v__4__/home/soutade/proj/branch/v2

cd v__1
/home/soutade/proj/v1

cd br v2
/home/soutade/proj/branch/v2


Remove an item :

cd -r /home/soutade/proj/\\*
>>> /home/soutade/proj correctly removed from database
cd --list
/home/soutade/proj/v1
/home/soutade/proj/v2
/home/soutade/proj/branch/v2


Modify an item :

cd -m /home/soutade/proj/v2 /home/soutade/proj/v3
>>> '/home/soutade/proj/v2' is now '/home/soutade/proj/v3'