autojump.plugin.zsh
1936 bytes
1declare -a autojump_paths
2autojump_paths=(
3 $HOME/.autojump/etc/profile.d/autojump.zsh # manual installation
4 $HOME/.autojump/share/autojump/autojump.zsh # manual installation
5 $HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation
6 /run/current-system/sw/share/autojump/autojump.zsh # NixOS installation
7 /etc/profiles/per-user/$USER/share/autojump/autojump.zsh # Home Manager, NixOS with user-scoped packages
8 /usr/share/autojump/autojump.zsh # Debian and Ubuntu package
9 $PREFIX/share/autojump/autojump.zsh # Termux package
10 /etc/profile.d/autojump.zsh # manual installation
11 /etc/profile.d/autojump.sh # Gentoo installation
12 /usr/local/share/autojump/autojump.zsh # FreeBSD installation
13 /usr/pkg/share/autojump/autojump.zsh # NetBSD installation
14 /opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
15 /usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
16 /opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
17 /opt/pkg/share/autojump/autojump.zsh # macOS with pkgsrc
18 /etc/profiles/per-user/$USER/etc/profile.d/autojump.sh # macOS Nix, Home Manager and flakes
19 /nix/var/nix/gcroots/current-system/sw/share/zsh/site-functions/autojump.zsh # macOS Nix, nix-darwin
20)
21
22for file in $autojump_paths; do
23 if [[ -f "$file" ]]; then
24 source "$file"
25 found=1
26 break
27 fi
28done
29
30# if no path found, try Homebrew
31if (( ! found && $+commands[brew] )); then
32 file=$(brew --prefix)/etc/profile.d/autojump.sh
33 if [[ -f "$file" ]]; then
34 source "$file"
35 found=1
36 fi
37fi
38
39(( ! found )) && echo '[oh-my-zsh] autojump not found. Please install it first.'
40
41unset autojump_paths file found