bindkey -L | grep backward-wordexample output
bindkey "^[B" backward-word
bindkey "^[[1;5D" backward-word
bindkey "^[b" backward-word
bindkey -L | grep forward-wordexample output
bindkey "^[F" forward-word
bindkey "^[[1;5C" forward-word
bindkey "^[f" forward-word
According to bindkey output, we can pick and choose any of the sequences.
^[ means escape.
So decided to use esc + b and esc + f for backward and forward navigation respectivly.
Open Keys preferences tab.
Preferences > Profile > [Selected profile] > Keys
Scroll through Key Mappings to find shortcut you want to modify or add a new one.
I modified the mappings for ⌥ ← and ⌥ → by double clicking and setting the following options:
Keyboard Shortcut : ⌥ ←
Action : Send escape sequence
Esc+ : b
Keyboard Shortcut : ⌥ →
Action : Send escape sequence
Esc+ : b
That's all to be able to use option + left and right to navigate between words on iTerm2 terminal emulator.
Thanks to Filip Danić posting detailed information on the subject.