‘“^[b” backward-word’ When trying to configure ZSH

escape-characterszsh

I am on a MAC, and I am trying to figure out shortcuts for my ZSH running on Iterm2.

When I type bindkey in the shell, I see (among other mappings), the following:

"^[b" backward-word
"^[f" forward-word

I know ^ is Control key. But what if I press Ctrl + [ + f, it does not go a word forward.

What am I missing?

Best Answer

^ is usually control, but ^[ actually means Escape or Alt (or meta, if you like emacs).

So you can press Escb or Escf for those key combinations.

By default, Alt doesn't work on Mac terminals, but iTerm2 has a setting: "Option acts as [ ] Normal [ ] Meta [ ] +Esc". You want +Esc.

Screenshot of iTerm2 Option key settings.

Related Question