iTerm - going one word backwards and forwards

Would it be possible to configure iTerm 2 to go backwards and forwards one word through the curent text in the command line using a keyboard shortcut?


Ctrl-[ b jumps back a word. You can also use Esc instead or Ctrl-[, and f to go forward.

That is Ctrl+[ release and then b orf. Or Esc and b or f.

More information can be found at this other discussion on AskDifferent.


Killing a fly with a cannon:

  • Go to Preferences... > Profiles > Keys (not Preferences... > Keys)
  • Press Presets... dropdown button.
  • Select Natural Text Editing

Then, you can move a word backwards using Option ⌥ + and a word forwards using Option ⌥ + , move to the start of the line using fn + and to the end of the line with fn + . Also you can delete a word backwards using Option ⌥ + , delete the whole line using Command ⌘ + .

If the preset doesn't appear, reinstall iTerm2. If you installed it using Homebrew+Cask:

brew cask reinstall iterm2