command-not-found.plugin.zsh 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. # Uses the command-not-found package zsh support
  2. # as seen in https://www.porcheron.info/command-not-found-for-zsh/
  3. # this is installed in Ubuntu
  4. [[ -e /etc/zsh_command_not_found ]] && source /etc/zsh_command_not_found
  5. # Arch Linux command-not-found support, you must have package pkgfile installed
  6. # https://wiki.archlinux.org/index.php/Pkgfile#.22Command_not_found.22_hook
  7. [[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && source /usr/share/doc/pkgfile/command-not-found.zsh
  8. # Fedora command-not-found support
  9. if [ -f /usr/libexec/pk-command-not-found ]; then
  10. command_not_found_handler () {
  11. runcnf=1
  12. retval=127
  13. [ ! -S /var/run/dbus/system_bus_socket ] && runcnf=0
  14. [ ! -x /usr/libexec/packagekitd ] && runcnf=0
  15. if [ $runcnf -eq 1 ]
  16. then
  17. /usr/libexec/pk-command-not-found $@
  18. retval=$?
  19. fi
  20. return $retval
  21. }
  22. fi
  23. # OSX command-not-found support
  24. # https://github.com/Homebrew/homebrew-command-not-found
  25. if type brew &> /dev/null; then
  26. if brew command command-not-found-init > /dev/null 2>&1; then
  27. eval "$(brew command-not-found-init)";
  28. fi
  29. fi