From: Christoph Lange <langec@gmx.de>
To: zsh-users@sunsite.auc.dk
Subject: IGNORE_EOF like in bash
Date: Wed, 25 Apr 2001 22:33:07 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.21.0104252225360.5979-100000@linux.local> (raw)
Hi there,
last year I suggested that the IGNORE_EOF shell option should be
implemented the same way as in bash, which means that the user can determine
how many consecutive presses of ^D are ignored before he or she is logged
out.
This has not been done by now, but I found out that one can script it in
zsh-4.0.1-pre-3 (maybe in other versions later than zsh-3.1.9, too), since
the shell no longer bypasses ZLE when ^D is pressed on an empty command
line.
Here is my solution, configurable by the variable IGNOREEOF:
IGNOREEOF=3 # or something like that
bash-ctrl-d() {
if [[ $CURSOR == 0 && -z $BUFFER ]]
then
[[ -z $IGNOREEOF || $IGNOREEOF == 0 ]] && exit
[[ $LASTWIDGET == bash-ctrl-d ]] \
&& (( --__BASH_IGNORE_EOF == 0 )) \
&& exit
: ${__BASH_IGNORE_EOF=$IGNOREEOF}
zle send-break
else
zle delete-char-or-list
fi
}
zle -N bash-ctrl-d
bindkey "^D" bash-ctrl-d
Hope you find it useful,
Christoph
--
Geeks aren't interested in politics because government doesn't
double its efficiency and speed once every 18 months.
Christoph Lange, langec@gmx.de, http://www.cul.de/home/yaph/, ICQ #51191833
next reply other threads:[~2001-04-25 20:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-25 20:33 Christoph Lange [this message]
2001-04-26 3:49 ` Bart Schaefer
2001-04-26 9:07 ` Christoph Lange
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.21.0104252225360.5979-100000@linux.local \
--to=langec@gmx.de \
--cc=duke@cyberspaces.de \
--cc=zsh-users@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).