Move the cursor word by word on Mac OS X iTerm2

Mac OS X doesn’t support readline’s alt-b and alt-f.  It has esc-b and esc-f instead.  But, you cannot hold esc to keep moving cursor, instead, you have to type esc-b or esc-f every time to move one word. This is very annoying to me until I found a solution with iTerm2.

Hers’s how to make iTerm2 to support alt-b and alt-f:

  1. Command-; to bring up the Preference menu
  2. Select Keys tab
  3. Click + button on the bottom of the right section (see the red cycle on the screen shot)
  4. Add shortcut key (see the red rectangle on the screen shot) for alt-f and alt-b
  5. Profit

move_cursor_word_by_word