On Fri, 19 Sep 2008 18:20:45 +0200 Simon Ruderich <simon@xxxxxxxxxxxx> wrote: SR> I'm using the following function which works fine for me, not sure though if SR> it's the best solution: SR> SR> TRAPINT() { SR> # Store the current buffer in the history. SR> zle && print -s $BUFFER SR> SR> # Return the default exit code so zsh aborts the current command. SR> return $1 SR> } Hello, I've been using this tip since the day it was posted here and it worked great: pressing Ctrl-C is much more convenient/easier to remember than using a separate key combination for "cancel but save in history" that I used before, thanks Simon! However today I accidentally found out that pressing Ctrl-C on a line starting with '-' results in TRAPINT:1: bad option: - error message. The fix for this is, of course, obvious but I thought to post it here just in case anybody else decides to copy this from the list archives to their .zshrc, so here is the updated function: % which TRAPINT TRAPINT () { zle && print -s -- $BUFFER return $1 } Thanks again to Simon for the original tip! VZ
Attachment:
pgpJNJCTeozye.pgp
Description: PGP signature