Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's say I want to bind R to redo in vicmd mode.

This works.

bindkey -a r redo

If I change it to this, it does not work.

bindkey -a rr redo

I have tried different things with no success. Is this not possible? I know it should be possible to bind sequences to keys in emacs mode, but can you do the same with letters in vi mode?

share|improve this question
up vote 1 down vote accepted

In the standard vicmd mode R is already bound to vi-replace-chars.

So when you define R+R to redo with

bindkey -a rr redo

you have two possible actions Zsh could follow when R is pressed

  1. interpret it as the command vi-replace-chars or
  2. wait for a second character and then interpret the command redo

The algorithm for matching keyboard commands in Zsh favors short commands so it will always use the 1. action.

To stop Zsh from doing this you first need to remove the binding for R with

bindkey -a -r r

and then add your new option with

bindkey -a rr redo

You can then also add vi-replace-chars with

bindkey -a re vi-replace-chars
share|improve this answer
Ah thank you for that information. Based on what I read, for emacs mode you could have both something like '^x' and '^x^a' and it would wait long enough. Unbinding r fixed the problem; I should have tried that right away. Thank you. – noctuid Mar 29 '14 at 15:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.