summaryrefslogtreecommitdiff
path: root/user:hugues
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@qosmos.com>2013-09-27 17:01:32 +0200
committerHugues Hiegel <hugues.hiegel@qosmos.com>2013-09-27 17:07:46 +0200
commit03fb0e46ca19a4486a7c104ce0b70b346869a467 (patch)
treef0ed222c66c85a79f69f9f69f1de38dce42e5414 /user:hugues
parentda9ec47882b091c0d95f2ef57b83f2f3889aa8ab (diff)
[Keys] Asks confirmation before exiting top zsh process
Diffstat (limited to 'user:hugues')
-rw-r--r--user:hugues/KeyBindings.zsh8
1 files changed, 7 insertions, 1 deletions
diff --git a/user:hugues/KeyBindings.zsh b/user:hugues/KeyBindings.zsh
index fb241f4..1c4a693 100644
--- a/user:hugues/KeyBindings.zsh
+++ b/user:hugues/KeyBindings.zsh
@@ -164,9 +164,15 @@ bindkey -v
# This setup may change the `ESC' keybinding to `C-d'. That defeats the
# possibility to exit zsh by pressing `C-d' (which usually sends EOF).
# With this widget, you can type `:q<RET>' to exit the shell from vicmd.
+if [ $( _process_tree | grep -o zsh | wc -l ) -gt 1 ]
+then
+ CONFIRM_EXIT=""
+else
+ CONFIRM_EXIT="confirm "
+fi
function ft-zshexit {
[[ -o hist_ignore_space ]] && BUFFER=' '
- BUFFER="${BUFFER}exit"
+ BUFFER="${BUFFER}${CONFIRM_EXIT}exit"
zle .accept-line
}
zle -N q ft-zshexit