### Install Autojump from Source Source: https://context7.com/wting/autojump/llms.txt Instructions for installing autojump from its source code. Includes options for custom installation paths and system-wide installation. ```bash git clone https://github.com/wting/autojump.git cd autojump ./install.py ``` ```bash ./install.py --destdir /custom/path --prefix /usr/local ``` ```bash sudo ./install.py --system ``` -------------------------------- ### Run the autojump installation script Source: https://github.com/wting/autojump/wiki/Home Execute the install.sh script to perform an automatic installation of autojump. The script will guide you through the necessary steps. ```shell ./install.sh ``` -------------------------------- ### Installation Source: https://context7.com/wting/autojump/llms.txt Instructions for installing autojump from source or via package managers, and configuring it for various shells. ```APIDOC ## Installation Install autojump from source or via package managers. After installation, source the appropriate shell configuration file in your shell's rc file. ### Install from Source ```bash git clone https://github.com/wting/autojump.git cd autojump ./install.py ``` #### Custom Destination ```bash ./install.py --destdir /custom/path --prefix /usr/local ``` #### System-wide Installation (requires root) ```bash sudo ./install.py --system ``` ### Uninstall ```bash ./uninstall.py ``` ### Package Manager Installation **Debian/Ubuntu:** ```bash apt-get install autojump ``` **macOS Homebrew:** ```bash brew install autojump ``` **Fedora/RHEL:** ```bash dnf install autojump-zsh # or autojump-fish, autojump-bash ``` ### Shell Configuration After installation, add the following lines to your shell's rc file: **Bash (`~/.bashrc` or `~/.profile` on macOS):** ```bash [[ -s /usr/share/autojump/autojump.sh ]] && source /usr/share/autojump/autojump.sh ``` **Zsh (`~/.zshrc`):** ```zsh [[ -s /usr/share/autojump/autojump.sh ]] && source /usr/share/autojump/autojump.sh autoload -U compinit && compinit -u ``` **Fish (`~/.config/fish/config.fish`):** ```fish if test -f /usr/share/autojump/autojump.fish; . /usr/share/autojump/autojump.fish; end ``` ``` -------------------------------- ### Run Autojump Installation Script Source: https://github.com/wting/autojump/blob/master/docs/install.md Navigate to the cloned directory and execute the install script. The uninstall script is also available. ```bash cd autojump ./install.py or ./uninstall.py ``` -------------------------------- ### Make install.sh executable Source: https://github.com/wting/autojump/wiki/Home Before running the installation script, ensure it has execute permissions. This is a prerequisite for automatic installation. ```shell chmod +x install.sh ``` -------------------------------- ### Install Autojump using Homebrew Source: https://github.com/wting/autojump/wiki/Home This snippet shows how to install Autojump using Homebrew, including applying a patch. Ensure your Homebrew installation is up-to-date. ```bash cd /usr/local curl https://github.com/mxcl/homebrew/pull/9560.patch | git am brew install autojump ``` -------------------------------- ### Global vs. Local Installation Source: https://github.com/wting/autojump/blob/master/CHANGES.md Installation scripts detect the environment to determine whether to perform a global or local install. These behaviors can be overridden using the --local or --global flags. The script also detects the shell type (bash or zsh) and installs the appropriate version. ```bash install.sh --local ``` ```bash install.sh --global ``` ```bash install.sh --bash ``` ```bash install.sh --zsh ``` -------------------------------- ### Fish Shell Tab Completion Example Source: https://context7.com/wting/autojump/llms.txt Shows how to use tab completion in the fish shell. Typing 'j' followed by tab provides native fish completion with directory options. ```fish j # Provides native fish completion with directory options ``` -------------------------------- ### Install Autojump via Homebrew (OS X) Source: https://github.com/wting/autojump/blob/master/docs/install.md Recommended installation method for Mac OS X using the Homebrew package manager. ```bash brew install autojump ``` -------------------------------- ### Install Autojump via MacPorts (OS X) Source: https://github.com/wting/autojump/blob/master/docs/install.md Alternative installation method for Mac OS X using the MacPorts package manager. ```bash port install autojump ``` -------------------------------- ### Bash/Zsh Tab Completion Example Source: https://context7.com/wting/autojump/llms.txt Demonstrates how to use tab completion in bash and zsh shells to preview and select matching directories. Type 'j' followed by tab to see options, then select by index number and tab. ```bash j # Shows menu of top database entries: # foo__1__/home/user/projects/foo # foo__2__/home/user/documents/foo # foo__3__/var/log/foo # Select by typing the index number and tab: j foo__2__ # Completes to: j foo__2__/home/user/documents/foo ``` -------------------------------- ### Install Autojump via Package Managers Source: https://context7.com/wting/autojump/llms.txt Commands for installing autojump using common package managers on Debian/Ubuntu, macOS, and Fedora/RHEL systems. ```bash # Debian/Ubuntu: apt-get install autojump ``` ```bash # macOS Homebrew: brew install autojump ``` ```bash # Fedora/RHEL: dnf install autojump-zsh # or autojump-fish, autojump-bash ``` -------------------------------- ### Source autojump profile manually Source: https://github.com/wting/autojump/wiki/Home If you do not have root access or prefer manual installation, copy the autojump scripts to appropriate locations and source the autojump.bash file in your .bashrc. ```shell source /path/to/autojump.bash ``` -------------------------------- ### Configure Shell for Autojump Source: https://context7.com/wting/autojump/llms.txt Instructions for sourcing the autojump shell script in your shell's rc file (e.g., .bashrc, .zshrc, config.fish) after installation. ```bash # For bash (~/.bashrc or ~/.profile on macOS): [[ -s /usr/share/autojump/autojump.sh ]] && source /usr/share/autojump/autojump.sh ``` ```zsh # For zsh (~/.zshrc): [[ -s /usr/share/autojump/autojump.sh ]] && source /usr/share/autojump/autojump.sh autoload -U compinit && compinit -u ``` ```fish # For fish (~/.config/fish/config.fish): if test -f /usr/share/autojump/autojump.fish; . /usr/share/autojump/autojump.fish; end ``` -------------------------------- ### Uninstall Autojump Source: https://context7.com/wting/autojump/llms.txt Command to uninstall autojump if it was installed from source. ```bash ./uninstall.py ``` -------------------------------- ### Jump to a directory containing 'foo', preferring child directories Source: https://github.com/wting/autojump/blob/master/README.md Use 'jc' to prioritize child directories over other matches in the database when jumping. ```bash jc foo ``` -------------------------------- ### Display autojump help Source: https://github.com/wting/autojump/blob/master/docs/header.md Access the full help documentation for autojump to explore all available options and configurations. This command provides comprehensive usage information. ```bash autojump --help ``` -------------------------------- ### View Database Statistics (`autojump --stat` or `j -s`) Source: https://context7.com/wting/autojump/llms.txt View the current autojump database entries with their weights to understand directory ranking. Higher weights indicate more frequently visited directories. The output includes total weight, number of entries, and current directory weight. ```bash # View database statistics autojump --stat # Or use the shorthand: j -s ``` ```bash # Example output: # 10.0: /home/user/downloads # 22.4: /home/user/documents # 31.6: /home/user/projects/webapp # 44.7: /home/user/projects # 89.4: /home/user # ________________________________________ # # 198: total weight # 5: number of entries # # 44.7: current directory weight # # data: /home/user/.local/share/autojump/autojump.txt ``` -------------------------------- ### Manually Adjust Directory Weight (`--increase` / `--decrease`) Source: https://context7.com/wting/autojump/llms.txt Manually adjust the weight of the current directory using `--increase` or `--decrease`. This allows fine-tuning the database when automatic learning doesn't match preferences. Weights can be adjusted by a default or specific amount. ```bash # Increase current directory weight by default amount (10) autojump --increase # Or: j -i ``` ```bash # Increase by specific amount autojump --increase 20 ``` ```bash # Decrease current directory weight by default amount (15) autojump --decrease # Or: j -d ``` ```bash # Decrease by specific amount autojump --decrease 5 ``` ```bash # Example output after adjustment: # 54.7: /home/user/projects ``` -------------------------------- ### Jump using multiple arguments Source: https://github.com/wting/autojump/blob/master/docs/header.md When multiple directories match a keyword, provide additional keywords to 'j' to specify which directory to jump to. The command prioritizes entries based on weight and the order of arguments. ```bash j w in ``` -------------------------------- ### Add Directory to Database (`--add`) Source: https://context7.com/wting/autojump/llms.txt Manually add a specific directory to the autojump database using the `--add` command. This is useful for directories that might not be automatically learned through normal usage. ```bash # Add a specific directory autojump --add /path/to/important/project ``` -------------------------------- ### Open directory in file manager Source: https://github.com/wting/autojump/blob/master/docs/header.md Use the 'jo' command to open the specified directory in your system's default file manager instead of changing the current directory. This is helpful for visual browsing. ```bash jo music ``` -------------------------------- ### Display autojump database statistics Source: https://github.com/wting/autojump/wiki/Home The '--stat' option displays the contents of the autojump database, including directory paths and their associated 'key weight', which reflects usage frequency. This command helps in understanding autojump's learning. ```shell j --stat ``` -------------------------------- ### Open Child Directory in File Manager (`jco`) Source: https://context7.com/wting/autojump/llms.txt Use `jco` to open a subdirectory of the current working directory in the file manager. This combines the child directory matching of `jc` with the file manager opening of `jo`. ```bash # Current directory: /home/user/photos # Open child directory "vacation" in file manager jco vacation # Opens /home/user/photos/2023/vacation in Finder/Nautilus/Explorer ``` ```bash # This is equivalent to: jo $(pwd) vacation ``` -------------------------------- ### Python API: Match Functions Source: https://context7.com/wting/autojump/llms.txt Utilize autojump's core matching algorithms programmatically in Python to find matching directory entries. ```APIDOC ## Python API: Match Functions The core matching algorithms can be used programmatically. These functions take needles (search terms) and a haystack (list of Entry objects) and return matching entries. ### Usage ```python from autojump_data import Entry from autojump_match import match_anywhere, match_consecutive, match_fuzzy # Create database entries (path, weight) entries = [ Entry('/home/user/projects/webapp', 50), Entry('/home/user/projects/api', 30), Entry('/var/log/webapp', 20), Entry('/home/user/documents', 10), ] # match_anywhere: matches needles anywhere in path (in order, not consecutive) results = list(match_anywhere(['proj', 'web'], entries)) # Returns: [Entry('/home/user/projects/webapp', 50)] # match_consecutive: matches needles at consecutive path segments at end of path results = list(match_consecutive(['projects', 'api'], entries)) # Returns: [Entry('/home/user/projects/api', 30)] # match_fuzzy: approximate matching using sequence similarity (threshold=0.6) results = list(match_fuzzy(['webap'], entries)) # Returns entries where last directory name is ~60% similar to "webap" # Case-insensitive matching results = list(match_anywhere(['PROJ'], entries, ignore_case=True)) # Returns: [Entry('/home/user/projects/webapp', 50), Entry('/home/user/projects/api', 30)] # Matching priority in autojump: # 1. Consecutive match (needles match consecutive segments at path end) # 2. Fuzzy match (approximate string matching) # 3. Anywhere match (needles appear anywhere in path, in order) ``` ``` -------------------------------- ### Clone Autojump Repository Source: https://github.com/wting/autojump/blob/master/docs/install.md Use this command to download the Autojump source code from GitHub. ```bash git clone git://github.com/wting/autojump.git ``` -------------------------------- ### Jump to Child Directory (`jc`) Source: https://context7.com/wting/autojump/llms.txt Use `jc` to jump to a subdirectory of the current working directory, prioritizing matches within your current location. This is equivalent to `j $(pwd) `. ```bash # Current directory: /home/user/projects # Jump to child directory containing "api" jc api # Result: /home/user/projects/my-app/api ``` ```bash # This is equivalent to: j $(pwd) api ``` ```bash # Useful when you have multiple directories with similar names # but want to stay within your current project cd /home/user/projects/frontend jc components # Result: /home/user/projects/frontend/src/components ``` -------------------------------- ### Jump to a directory containing 'foo' Source: https://github.com/wting/autojump/blob/master/docs/header.md Use the 'j' command followed by a keyword to jump to the most relevant directory in your autojump database. Ensure the directory has been visited previously. ```bash j foo ``` -------------------------------- ### Python API: Data Management Source: https://context7.com/wting/autojump/llms.txt Illustrates functions for loading, saving, and manipulating the autojump database using Python. Includes configuration, data conversion, and database file format. ```python from autojump_data import load, save, dictify, entriefy, Entry # Configuration dictionary config = { 'data_path': '/home/user/.local/share/autojump/autojump.txt', 'backup_path': '/home/user/.local/share/autojump/autojump.txt.bak' } # Load database (returns dict: path -> weight) data = load(config) # Example: {'/home/user/projects': 50.0, '/var/log': 20.0} # Convert dict to Entry iterator entries = list(entriefy(data)) # Example: [Entry('/home/user/projects', 50.0), Entry('/var/log', 20.0)] # Convert entries back to dict data = dictify(entries) # Modify and save database data['/home/user/newproject'] = 10.0 save(config, data) # Database file format (autojump.txt): # \t # Example: # 50.0 /home/user/projects # 20.0 /var/log # Automatic backup is created if backup file doesn't exist ``` -------------------------------- ### Report bugs and issues Source: https://github.com/wting/autojump/blob/master/README.md Visit the autojump GitHub issues page to report any bugs, suggest features, or ask questions. ```bash https://github.com/wting/autojump/issues ``` -------------------------------- ### Tab Completion Source: https://context7.com/wting/autojump/llms.txt Autojump provides tab completion for bash, zsh, and fish shells, enabling users to preview and select from matching directories. ```APIDOC ## Tab Completion autojump supports tab completion in bash, zsh, and fish shells. This allows you to preview and select from multiple matching directories. ### Bash/Zsh Type `j` followed by space and then press Tab twice. ```bash j ``` This will display a menu of top database entries: ``` foo__1__/home/user/projects/foo foo__2__/home/user/documents/foo foo__3__/var/log/foo ``` To select an entry, type its index number followed by Tab: ```bash j foo__2__ ``` This will complete to: `j foo__2__/home/user/documents/foo` ### Fish Shell In the fish shell, simply type `j` and press Tab: ```fish j ``` This provides native fish completion with directory options. ``` -------------------------------- ### Jump to a directory using autojump Source: https://github.com/wting/autojump/wiki/Home Use 'j' followed by a directory specifier to jump to the most frequently used directory matching the pattern. This complements, rather than replaces, the 'cd' command. ```shell j mp3 ``` -------------------------------- ### Enable ZSH Tab Completion Source: https://github.com/wting/autojump/blob/master/CHANGES.md To enable ZSH tab completion, load the compinit module by adding the specified line to your ~/.zshrc file. This allows autojump to display a menu of top database entries when you type 'j' followed by tab completion. ```zsh autoload -U compinit; compinit ``` -------------------------------- ### Jump to a child directory Source: https://github.com/wting/autojump/blob/master/docs/header.md The 'jc' command allows you to jump to a child directory (a subdirectory of the current directory) without typing the full path. This is useful for quick navigation within your current location. ```bash jc bar ``` -------------------------------- ### Python API: Match Anywhere Source: https://context7.com/wting/autojump/llms.txt Demonstrates the `match_anywhere` function from the autojump Python API. It matches search terms (needles) anywhere within the directory path, in the order provided. ```python from autojump_data import Entry from autojump_match import match_anywhere, match_consecutive, match_fuzzy # Create database entries (path, weight) entries = [ Entry('/home/user/projects/webapp', 50), Entry('/home/user/projects/api', 30), Entry('/var/log/webapp', 20), Entry('/home/user/documents', 10), ] # match_anywhere: matches needles anywhere in path (in order, not consecutive) results = list(match_anywhere(['proj', 'web'], entries)) # Returns: [Entry('/home/user/projects/webapp', 50)] # match_consecutive: matches needles at consecutive path segments at end of path results = list(match_consecutive(['projects', 'api'], entries)) # Returns: [Entry('/home/user/projects/api', 30)] # match_fuzzy: approximate matching using sequence similarity (threshold=0.6) results = list(match_fuzzy(['webap'], entries)) # Returns entries where last directory name is ~60% similar to "webap" # Case-insensitive matching results = list(match_anywhere(['PROJ'], entries, ignore_case=True)) # Returns: [Entry('/home/user/projects/webapp', 50), Entry('/home/user/projects/api', 30)] # Matching priority in autojump: # 1. Consecutive match (needles match consecutive segments at path end) # 2. Fuzzy match (approximate string matching) # 3. Anywhere match (needles appear anywhere in path, in order) ``` -------------------------------- ### Open child directory in file manager Source: https://github.com/wting/autojump/blob/master/docs/header.md Combine 'jco' to open a child directory in the file manager. This provides a convenient way to visually explore subdirectories without navigating to them. ```bash jco images ``` -------------------------------- ### Jump to Directory with autojump (`j`) Source: https://context7.com/wting/autojump/llms.txt Use `j` to jump to a frequently used directory. The search is case-insensitive by default but becomes case-sensitive if uppercase letters are present in the pattern. Multiple patterns can be used to narrow down results. ```bash # Jump to a directory containing "foo" j foo ``` ```bash # Jump to a directory matching multiple patterns (narrows results) # Given database: # 30 /home/user/mail/inbox # 10 /home/user/work/inbox # "j in" would jump to /home/user/mail/inbox (higher weight) # "j w in" would jump to /home/user/work/inbox (matches both "w" and "in") j w in ``` ```bash # Example output when jumping: # /home/user/work/inbox (displayed in red, then cd occurs) ``` ```bash # If directory not found: # autojump: directory 'nonexistent' not found # Try `autojump --help` for more information. ``` -------------------------------- ### Source autojump profile for Bash Source: https://github.com/wting/autojump/wiki/Home To enable autojump functionality in your Bash shell, source the autojump profile script. This is typically done in your .bashrc file. ```shell source /etc/profile.d/autojump.sh ``` -------------------------------- ### Python API: Data Management Source: https://context7.com/wting/autojump/llms.txt Functions for loading, saving, and manipulating the autojump database programmatically using Python. ```APIDOC ## Python API: Data Management Functions for loading, saving, and manipulating the autojump database. ### Usage ```python from autojump_data import load, save, dictify, entriefy, Entry # Configuration dictionary config = { 'data_path': '/home/user/.local/share/autojump/autojump.txt', 'backup_path': '/home/user/.local/share/autojump/autojump.txt.bak' } # Load database (returns dict: path -> weight) data = load(config) # Example: {'/home/user/projects': 50.0, '/var/log': 20.0} # Convert dict to Entry iterator entries = list(entriefy(data)) # Example: [Entry('/home/user/projects', 50.0), Entry('/var/log', 20.0)] # Convert entries back to dict data = dictify(entries) # Modify and save database data['/home/user/newproject'] = 10.0 save(config, data) # Database file format (autojump.txt): # \t # Example: # 50.0\t/home/user/projects # 20.0\t/var/log # Automatic backup is created if backup file doesn't exist ``` ``` -------------------------------- ### Purge Non-Existent Paths Source: https://context7.com/wting/autojump/llms.txt The `--purge` option removes all non-existent paths from the autojump database, which is useful for cleaning up after directories have been moved or deleted. ```APIDOC ## Purge Non-Existent Paths (`--purge`) Remove all non-existent paths from the database. Useful for cleaning up after directories have been moved or deleted. ### Method ```bash autojump --purge ``` ### Example Output ``` Purged 3 entries. ``` ### Description This command scans all database entries and removes those that no longer exist. ``` -------------------------------- ### Add Current Directory Manually Source: https://context7.com/wting/autojump/llms.txt Manually add the current directory to the autojump database. This is usually handled automatically by shell hooks. ```bash autojump --add "$(pwd)" ``` -------------------------------- ### Allow Symlink Database Entries Source: https://github.com/wting/autojump/blob/master/CHANGES.md To preserve symlink paths in the database instead of resolving them to their full paths, set the AUTOJUMP_KEEP_SYMLINKS environment variable to 1. This modifies the default behavior of preventing duplicate entries. ```bash export AUTOJUMP_KEEP_SYMLINKS=1 ``` -------------------------------- ### Purge Non-Existent Paths Source: https://context7.com/wting/autojump/llms.txt Remove all directories from the autojump database that no longer exist on the filesystem. This is useful for cleaning up after moving or deleting directories. ```bash autojump --purge ``` -------------------------------- ### Configure Case-Insensitive Search Source: https://github.com/wting/autojump/blob/master/CHANGES.md Set the AUTOJUMP_IGNORE_CASE environment variable to 1 to always use case-insensitive search. This ensures that the search prioritizes exact matches first, then case-insensitive matches. ```bash export AUTOJUMP_IGNORE_CASE=1 ``` -------------------------------- ### Prevent Database Decay Source: https://github.com/wting/autojump/blob/master/CHANGES.md To prevent the autojump database from being trimmed for performance reasons, set the AUTOJUMP_KEEP_ALL_ENTRIES environment variable to 1. This ensures that all entries are preserved in the database. ```bash export AUTOJUMP_KEEP_ALL_ENTRIES=1 ``` -------------------------------- ### Append to PROMPT_COMMAND in Bash Source: https://github.com/wting/autojump/blob/master/docs/body.md When using Autojump with bash, do not overwrite the existing PROMPT_COMMAND. Instead, append the autojump command to preserve existing functionality. ```bash export PROMPT_COMMAND="history -a" ``` ```bash export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ;} history -a" ``` -------------------------------- ### Append to PROMPT_COMMAND in bash Source: https://github.com/wting/autojump/blob/master/README.md For bash users, autojump modifies `$PROMPT_COMMAND`. To avoid overwriting existing commands, append new commands using this pattern. ```bash export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ;} history -a" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.