Jump to any previously visited directory by typing only part of its path.
After using the cd command several times, you'll have a collection of previously visited directories that you can access like bookmarks.
For example, suppose you once visited /home/user/Downloads/. The next time you want to return to the Downloads directory, you can simply type cd Downloads from anywhere, or even cd Dow.
The script declares a cd function that wraps your shell's own cd command. Every time you change directories, the full path is stored in ~/.autoleap.history.
Your shell's own cd is always attempted first, so all standard behavior is fully preserved — in Bash that includes CDPATH, cd -, cd old new substitution, and options such as -P and -L; in Fish it includes CDPATH, cd -, and the prevd/nextd/cdh directory history.
Autoleap only activates as a fallback when your shell's cd cannot resolve the path.
When the fallback is triggered, Autoleap searches the history file using your input and changes to the best matching directory. If multiple matches are found, Autoleap uses fzf (if available) to display an interactive selection menu. Exact matches on the final directory name are prioritized over broader substring matches, while preserving that ranking in the displayed list.
Directories that no longer exist are automatically removed from the history file when encountered.
Both shells share the same history file and the same matching code: autoleap.sh holds the entire matching implementation, and the Fish integration calls it as a command to ask "which directory best matches this?", then performs the cd itself. Bash and Fish sessions therefore build one common set of bookmarks.
- Bash: Fish users need it too:
autoleap.shprovides the directory matching for both shells, so it must be installed even if you never use Bash interactively. fzf(optional). Install the package for your Linux distribution to enable the interactive directory selection menu.
- Download
autoleap.shto a convenient location (for example,~/.local/bin/). - Source the script from your
.bashrcby adding the following line:
source ~/.local/bin/autoleap.sh- Restart your terminal or run:
source ~/.bashrc- Download both
autoleap.shandautoleap.fishto the same location (for example,~/.local/bin/or/usr/local/bin/). - Source the Fish file from your
config.fishby adding the following line, adjusting the path to wherever you saved it:
source ~/.local/bin/autoleap.fish- Restart your terminal or run:
source ~/.config/fish/config.fishautoleap.fish locates autoleap.sh on its own: first beside itself (following symlinks, so linking autoleap.fish into conf.d/ works), then in ~/.local/bin/, /usr/local/bin/ and /usr/bin/. Keeping the two files together is all that is normally required.
Only if you keep them in separate directories, set $autoleap_script to the full path of autoleap.sh before sourcing:
set -g autoleap_script /path/to/autoleap.sh
source /somewhere/else/autoleap.fishThis project was inspired by wting/autojump. However, autojump is larger than I wanted and has too many dependencies, so I created autoleap.
