Ask Different is a question and answer site for power users of Apple hardware and software. 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

I'm in Lion

with iTerm2, Zsh and Oh-My-Zsh

but I cannot move through words when pressing: ALT+left arrow or CMD+left arrow or something

instead, when I press "ALT+right arrow" it prints [C and when I press "SHIFT+ALT+left arrow" it prints D0

how I can config iTerm2 to behave like any other program when moving through words?

share|improve this question
solution a possible solution for this… – fespinozacast Jan 6 '12 at 20:20
fespinozacast: the link no longer works. Do you remember what was the solution for your question? – wvega Mar 9 '14 at 18:47

I finally found the solution to this problem here: The necessary steps are shown below:

  1. Go to Preferences, Profile, Keys.
  2. Set your left ⌥ key to act as an escape character.
  3. Locate the current shortcut for ⌥ ← or create a new one, with the following settings:
    • Keyboard Shortcut: ⌥←
    • Action: Send Escape Sequence
    • Esc+: b
  4. repeat for the ⌥→ keyboard shortcut with the following settings:
    • Keyboard Shortcut: ⌥→
    • Action: Send Escape Sequence
    • Esc+: f
share|improve this answer
While these links may answer the question, it is better to include the essential parts of the answer here and provide the links for reference. Link-only answers can become invalid if the linked pages change. – grgarside Mar 9 '14 at 19:51
I did include the essential parts of the solution in the answer I posted in SuperUser. I understand what you say, but I was wondering if it would still apply when you are linking to an answer in a StackExchange website. Another reason I didn't include the solution steps here is because my two answers would have come out identical, even tough they are in different SE sites. What's the preferred way of doing things in a situation like this? – wvega Mar 10 '14 at 0:36
Perhaps one of the questions is in the wrong site. Should I flag it, instead of providing the same answer for both? – wvega Mar 10 '14 at 0:37
I provided the necessary steps for the solution, so the answers remains useful if the linked article ever goes down. – wvega Mar 12 '14 at 5:03

The default is on Control-left Control-right. To customize, edit preferences/Keys and associate the escape code to some other hotkey of your choice

enter image description here

share|improve this answer

To make option-left and option-right move through words in iTerm 2, add

bindkey -e
bindkey '\e\e[C' forward-word
bindkey '\e\e[D' backward-word

to ~/.zshrc if you use zsh, or add

"\e\e[C": forward-word
"\e\e[D": backward-word

to ~/.inputrc if you use bash.

Control-left would be \e[1;9D in iTerm 2 and \e[1;5D in Terminal, and control-right would be \e[1;9C in iTerm 2 and \e[1;5C in Terminal.

To see the escape sequence for a key combination, run cat -v and then press the key combination.

share|improve this answer
Thank you, this worked. – Gaston Sanchez Oct 6 '15 at 20:32

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.