autojump.plugin.zsh 1.3 KB

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