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:
- zsh bindkey
- 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