/zsh_command_not_found
http://github.com/brinkman83/bashrc · #! · 25 lines · 20 code · 5 blank · 0 comment · 0 complexity · d8030e5bf568d7d6d126f88f70399e52 MD5 · raw file
- # (c) Zygmunt Krynicki 2007,
- # Licensed under GPL, see COPYING for the whole text
- #
- # This script will look-up command in the database and suggest
- # installation of packages available from the repository
- # Pseudo-namespace cnf_
- function cnf_preexec() {
- typeset -g cnf_command="${1%% *}"
- }
- function cnf_precmd() {
- (($?)) && [ -n "$cnf_command" ] && [ -x /usr/lib/command-not-found ] && {
- whence -- "$cnf_command" >& /dev/null ||
- /usr/bin/python /usr/lib/command-not-found -- "$cnf_command"
- unset cnf_command
- }
- }
- typeset -ga preexec_functions
- typeset -ga precmd_functions
- preexec_functions+=cnf_preexec
- precmd_functions+=cnf_precmd