Skip to content

Instantly share code, notes, and snippets.

@sasha1sum
Created April 18, 2017 17:46
Show Gist options
  • Save sasha1sum/1cf69783f24af59c1370cc55327482ce to your computer and use it in GitHub Desktop.
Save sasha1sum/1cf69783f24af59c1370cc55327482ce to your computer and use it in GitHub Desktop.
# Prevent exiting out of the root shell while still allowing it most shells to exit with C-d
setopt ignoreeof
ctrl-d () {
if (( $SHLVL > 1 )); then
exit;
else
zle -M "zsh: use 'exit' to exit"
return 1
fi
}
zle -N ctrl-d
bindkey '^D' ctrl-d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment