]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
zsh/rc: Ctrl-C doesn't store the line if histignorespace applies.
authorSimon Ruderich <simon@ruderich.org>
Sun, 14 Oct 2012 19:58:19 +0000 (21:58 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sun, 14 Oct 2012 19:58:19 +0000 (21:58 +0200)
zsh/rc

diff --git a/zsh/rc b/zsh/rc
index 55e92424562027b001676243b47ea43594cc8aa3..be8e8f5c39e0c9043c24368877d42d258fa2216b 100644 (file)
--- a/zsh/rc
+++ b/zsh/rc
@@ -601,6 +601,12 @@ bindkey '^F' complete-files
 # <nyh@math.technion.ac.il> for a fix (-r) to handle whitespace/quotes
 # correctly, both on the Zsh mailing list.
 TRAPINT() {
+    # Don't store this line in history if histignorespace is enabled and the
+    # line starts with a space.
+    if [[ -o histignorespace && ${BUFFER[1]} = " " ]]; then
+        return $1
+    fi
+
     # Store the current buffer in the history.
     zle && print -s -r -- $BUFFER