Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I logged in on one of hosting provider servers and noticed ALT + left and ALT + right moved between words in a shell prompt in a screen.

What kind of key bindings I need to configure and where to get this behavior to my local OSX zsh running in iTerm 2?

share|improve this question

3 Answers 3

I found the solution here: Will copy the most important parts of it, in case the link goes down.

  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

You are looking for the keywords backward-word and forward-word. So if you are on a shell where the keybindings aren't working try bindkey -L | grep backward-word in order to check if they are even configured. There's more information about this in zshzle(1).

You can manually set the keybinding by typing something like this:

bindkey 'Ctrl+v Alt+Right' forward-word

bindkey 'Ctrl+v Alt+Left' backward-word

I've had some troubles with keybindings too and the problem was almost always that the Option/Alt key sent something different than the expected Meta/Escape.

share|improve this answer

I suggest you use zkbd to configure keybindings. I use it and Alt+Left / Alt+Right works fine on iTerm2. See zshcontrib(1) for details on zkbd.

share|improve this answer

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.