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.

For some reason I am unable to bind Ctrl-Left Arrow and Ctrl-Right Arrow to move between words in ZSH after installing oh-my-zsh on my MacBook Pro.

In iTerm2 I have my keybindings configured to "Send Escape Sequence" [1;5D and [1;5C, which worked before installing oh-my-zsh.

I also tried uncommenting

bindkey '^[^[[C' emacs-forward-word
bindkey '^[^[[D' emacs-backward-word

in ~/.oh-my-zsh/lib/key-bindings.zsh, also to no avail. In both scenarios, hitting Ctrl-Left/Right just sends "5D" and "5C" to the screen.

TLDR: Has anyone gotten Ctrl-Left and Ctrl-Right to move between words when using oh-my-zsh?

share|improve this question

migrated from serverfault.com Jun 23 '11 at 10:28

This question came from our site for professional system and network administrators.

3 Answers 3

This one worked for me:

bindkey "[C" emacs-forward-word   #control left
bindkey "[D" backward-word        #control right

In fact, I pressed Control+left and Control+right between the "" and that did the magic.

share|improve this answer

Change your bindkey lines to:

bindkey '^[[1;5C' emacs-forward-word
bindkey '^[[1;5D' emacs-backward-word
share|improve this answer

So you have your terminal emulator sending one CSI sequence (ESC+[+1;5C) for the key, but you've told your shell with the bindkey command to watch the terminal input for a different CSI sequence (ESC+ESC+[+C), and you are wondering why this doesn't work?

It doesn't work for the very obvious reason.

share|improve this answer

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.