Skip to content

Instantly share code, notes, and snippets.

@geta6
Last active December 16, 2015 20:29
Show Gist options
  • Save geta6/5493006 to your computer and use it in GitHub Desktop.
Save geta6/5493006 to your computer and use it in GitHub Desktop.
zshでCommandNotFoundにhookするスクリプトできたよー^O^ノ
preexec () {
[[ -z "`whence ${1%% *}`" ]] && echo "NOTFOUND!!! ${1%% *}"
}
# ---- #
preexec () {
cmd=${1%% *}
if [ -z "`whence ${cmd}`" ]; then
if [ $cmd = 'yabai' ]; then
arg=${1##* }
echo "$arg is YABAI"
fi
fi
}
#
# $ yabai a
# a is YABAI
# zsh: command not found: yabai
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment