From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16656 invoked from network); 25 Apr 2001 20:40:45 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 25 Apr 2001 20:40:45 -0000 Received: (qmail 28779 invoked by alias); 25 Apr 2001 20:40:27 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3828 Received: (qmail 28768 invoked from network); 25 Apr 2001 20:40:26 -0000 Date: Wed, 25 Apr 2001 22:33:07 +0200 (CEST) From: Christoph Lange Reply-To: Christoph Lange To: zsh-users@sunsite.auc.dk Subject: IGNORE_EOF like in bash Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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