My Emacs keybindings in zsh are not working (CtrlA, CtrlE). I use zsh on OS X.

They might be bound to some other thing. I'm currently using oh-my-zsh.

And my .zshrc is over here.

enter image description here

  • @rene Done! thx for the advice! :D Dec 24, 2012 at 16:52
  • From the screenshot I gather you are on Mac OS X? I have the same problem there in terminal. Ctrl+A/E/K are already taken in that OS (for use in text fields in the GUI), which might explain this.
    – Henno
    Dec 25, 2012 at 5:35
  • @Henno really? Im using zsh atm, and when i use bash, the ctrl+a(go to the first char of line) and ctrl+e(go to the end of the line) works fine. but when i use zsh, it goes like the screenshot. so i think its an problem about zsh, not the OS :( Dec 25, 2012 at 9:42
  • @TakehiroAdachi your fixed worked for me too!
    – Henno
    Dec 26, 2012 at 18:13
  • @Henno Great :D! Dec 27, 2012 at 6:40

2 Answers 2


I got the problem solved. Looks like oh-my-zsh was overriding the default keybindings.

When I added the below line at the end of my .zshrc, CtrlE and CtrlA worked:

bindkey -e
  • great, worked for me too!
    – Henno
    Dec 26, 2012 at 18:13
  • fixed my problem too. FWIW, I also found the guilty party in my ~/.zshrc: # Lines configured by zsh-newuser-install HISTFILE=~/.histfile HISTSIZE=1000 SAVEHIST=1000 bindkey -v 👈 So it looks like it's Apple being "helpful".
    – JL Peyret
    Jun 18 at 2:47

Generally speaking, you can find the code of a key by typing CtrlV and the key. You can then use this key with bindkey to map it to a zsh keyboard functionality (e.g. beginning-of-line).

In your specific case that would be CtrlV CtrlA and CtrlV CtrlE.

Then you can put the code in your .inputrc, the system /etc/inputrc, or your .zshrc like this:

bindkey '^A' beginning-of-line
bindkey '^E' end-of-line

This works for other keys too. For instance, I had some trouble with Home and End.

You should be able to use this trick in any terminal session : tty,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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