Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to rebind the hyphen in .zshrc?
- X-seq: zsh-users 14500
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Guido van Steen <gvsteen@xxxxxxxxx>
- Subject: Re: How to rebind the hyphen in .zshrc?
- Date: Fri, 16 Oct 2009 00:16:37 +0200
- Cc: ZSH User List <zsh-users@xxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=85muhU944wcb0oE6S5bsag7aOVX4v92Pu2nzLySEGHA=; b=JP15uFxlnxqZ/ilPB7C9h+TzWNc6f6XIuUElUp8kdwN1+VPSy2UzWqJs72z9WyTjsU zkMYATfE9zmTmtem9C8lpq6NVTfdL8YXM9KAUSiIdv0/ybh+JGfKr3uTJs4S8WvwEliQ 8IsPIbjTnYlUbFbOfzt97+GnTj2YN1awR6nA4=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=VGcyC8sCLKR1ylH0ZI+j1h3CuKpFSblHiRZIAvKarxM/eqHogkAD8P2UoS9EPsyXau ifIQy57QLFxfI6hjfZwltZuV5w1Otor5Oydlg1xkwcm7u8yNsUrIQZZria8gX+uxjhAK XearNtyqOM1oav/7L4Lfg58+kYekHtmQ2F6Nc=
- In-reply-to: <762234.69811.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <762234.69811.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author