command-not-found.plugin.zsh 917 B

12345678910111213141516171819202122232425
  1. # Uses the command-not-found package zsh support
  2. # as seen in http://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