Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Strange behaviour of setopt and binkey in a widget
- X-seq: zsh-workers 27890
- From: Mike Perdide <mike.perdide@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Strange behaviour of setopt and binkey in a widget
- Date: Mon, 19 Apr 2010 09:29:33 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:received:message-id :subject:from:to:content-type:content-transfer-encoding; bh=Eb896wD5C1ru+Xh+yW1/EEqvQSh/l+jbMQG7kuTMYwk=; b=EnyL//xwJyy0V51jgaKqlc0bdRJC2NZJ4gGmJn7CR60yeRYM5WfbDuKPpfRhmd5JPS LWW7zqo6V7pUKAp2zby4PBL6uualbmZXFeMIGGnFt/7MHLVCpk/Oqzdn8+te/V7IY7rp Wz8kGisgDuI7GNu+5jU5O+rmsS+qSupqHHwNc=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=bWFWCvObW61UMthr1qDB1/bhWWLhv8/TOZ9djgnf08dUorUOuh0I2VVsXt4qI2NCWy KedEvYWduMbXDRfAdnKRs1tosMVmwxc33oE/6+KS91uHlOCfR4tB/kMAQLImIuYbyhZI ntgakoA872Hf0N6Yy+VOVPESwFmT7yvpNZPAY=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Hello,
I'm trying to customize the behaviour of CTRL-D in certain conditions
and I 'm observing strange behaviours from zsh.
Here is what I do :
-------------- From my .zshrc
--------------------------------------------------------------
widg0() { echo "not really exiting"; }
zle -N widg0
widg1() { setopt ignoreeof; bindkey "^D" widg0; }
widg2() { unsetopt ignoreeof; bindkey -r "^D"; }
zle -N widg1
zle -N widg2
bindkey "^O" widg1
bindkey "^P" widg2
-------------- Starting from a bash shell :
--------------------------------------------
[22:49] :~$ zsh
north.~% <CTRL-O> <CTRL-D>
zsh: use 'exit' to exit.
north.~% <CTRL-D>not really exiting
!!! First strange behaviour : the prompt is not redrawn. At
this point I press <ENTER> to get my prompt back :
north.~% <CTRL-P> <CTRL-D>
!!! The previous ligne is rewritten with these two :
[22:53] :~$
zsh: use 'exit' to exit
-----------------------------------------------------------------------------------------------
The long story behind the ^D rebinding is that I'm using
virtualenvwrapper, that is a wrapper
around virtualenv, a tool designed to build virtual environments using
python. This wrapper
activates virtual environments by making directories and setting env
variables to these
directories (such as PATH). When a environment is activated, the only
way to deactivate it is
to enter "deactivate". Typing ctrl-d will exit the shell you're in,
and I think that's not a nice
behaviour. What I'm trying to do is to rebind ctrl-d so when it is
used in a virtual environment,
this environment would be deactivated but the shell wouldn't exit.
Am I doing something wrong ? Is the "strange" behaviour I'm observing
a feature I'm not using correctly ?
Thanks in advance.
Regards,
Mike Perdide.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author