Menu

Toshimaru's Blog

Enable option + arrow(⌥←, ⌥→) keys in Zsh/iTerm2

When you use option + arrow keys (such as + , + ) in your macOS teminal, the cursor doesn’t move.

$ [D [C # option + arrow key doesn't work!

There are two ways to fix this:

  1. zsh bindkey
  2. Key Mapping on iTerm2

1. zsh bindkey

To fix this, put this in your ~/.zshrc.

bindkey "[D" backward-word
bindkey "[C" forward-word

See also

2. Key Mapping on iTerm2

  • open iTerm2
  • Profiles -> Edit Profiles -> Keys
  • Click on Presets
  • Select Natural Text Editing

See also

Load more