Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

How to rebind ctrl-d in .zshrc?



Hi Mikael, 

Exactly what I was looking for! Thanks a lot! 

I have another kind of related question: 

Is is possible to rebind/extend ctrl-d in .zshrc or somewhere 
else too??

Cheers! 

Guido 

--- On Fri, 16/10/09, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:

> From: Mikael Magnusson <mikachu@xxxxxxxxx>
> Subject: Re: How to rebind the hyphen in .zshrc?
> To: "Guido van Steen" <gvsteen@xxxxxxxxx>
> Cc: "ZSH User List" <zsh-users@xxxxxxxxxx>
> Date: Friday, 16 October, 2009, 5:16 AM
> 2009/10/16 Guido van Steen <gvsteen@xxxxxxxxx>:
> > Dear all,
> >
> > In my .zshrc file I would like to include something
> like:
> >
> > rebind-hyphen {
> >        # intended pre-processing
> >        zle .self-insert
> >        # intended post-processing
> > }
> >
> > zle -N rebind-hyphen
> > bindkey "-" rebind-hyphen
> >
> > This produces the following error:
> >
> > "rebind-hyphen" undefined-key
> >
> > If I add:
> >
> > bindkey "a" rebind-hyphen
> >
> > or
> >
> > bindkey " " rebind-hyphen
> >
> > there is no error at all and "a" or " " gets bound.
> >
> > So, I guess hyphen must be a special input character
> to zsh.
> >
> > Is there a way around this??
> >
> > Thanks!
> >
> > Guido
> 
> The trick is a - starts an option, so you have to say you
> aren't
> giving any more options with the standard method:
> bindkey -- - whatever
> 
> You have to do that when aliasing something beginning with
> + or - too:
> alias -- +x='chmod +x'
> 
> I just noticed now though that I had just one hyphen in my
> .zshrc and
> that works too, so I'm not sure which is canonical, both
> appear to
> work though.
> 
> -- 
> Mikael Magnusson
> 

Send instant messages to your online friends http://uk.messenger.yahoo.com



Messages sorted by: Reverse Date, Date, Thread, Author