Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Dec 24 '12 at 2:37

This question came from our site for professional and enthusiast programmers.

    
A zero % accept rate is considered to be rather low. Can you accept some answers on your previous questions? –  rene Dec 23 '12 at 20:51
    
@rene Done! thx for the advice! :D –  Takehiro Adachi Dec 24 '12 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 '12 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 :( –  Takehiro Adachi Dec 25 '12 at 9:42
    
@TakehiroAdachi your fixed worked for me too! –  Henno Dec 26 '12 at 18:13
show 1 more comment

2 Answers

up vote 5 down vote accepted

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
share|improve this answer
    
great, worked for me too! –  Henno Dec 26 '12 at 18:13
add comment

You can find out what codes you need by typing 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,

share|improve this answer
add comment

Your Answer

 
discard

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.