autojump.plugin.zsh 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  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. )
  14. for file in $autojump_paths; do
  15. if [[ -f "$file" ]]; then
  16. source "$file"
  17. found=1
  18. break
  19. fi
  20. done
  21. # if no path found, try Homebrew
  22. if (( ! found && $+commands[brew] )); then
  23. file=$(brew --prefix)/etc/profile.d/autojump.sh
  24. if [[ -f "$file" ]]; then
  25. source "$file"
  26. found=1
  27. fi
  28. fi
  29. (( ! found )) && echo '[oh-my-zsh] autojump script not found'
  30. unset autojump_paths file found