autojump.plugin.zsh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. declare -a autojump_paths
  2. autojump_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. /usr/share/autojump/autojump.zsh # Debian and Ubuntu package
  8. /etc/profile.d/autojump.zsh # manual installation
  9. /etc/profile.d/autojump.sh # Gentoo installation
  10. /usr/local/share/autojump/autojump.zsh # FreeBSD installation
  11. /usr/pkg/share/autojump/autojump.zsh # NetBSD installation
  12. /opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
  13. /usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
  14. /opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
  15. )
  16. for file in $autojump_paths; do
  17. if [[ -f "$file" ]]; then
  18. source "$file"
  19. found=1
  20. break
  21. fi
  22. done
  23. # if no path found, try Homebrew
  24. if (( ! found && $+commands[brew] )); then
  25. file=$(brew --prefix)/etc/profile.d/autojump.sh
  26. if [[ -f "$file" ]]; then
  27. source "$file"
  28. found=1
  29. fi
  30. fi
  31. (( ! found )) && echo '[oh-my-zsh] autojump not found. Please install it first.'
  32. unset autojump_paths file found