Apple - iTerm - going one word backwards and forwards

Killing a fly with a cannon:

  • Go to Preferences... > Profiles > Keys (not Preferences... > Keys)
  • Press Presets...
  • 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

I like the following setup.

  1. Preferences > Keys (or Preferences > Profiles > Keys)
  2. Click the plus.

move forward one word

option+right
send escape sequence
f

move back one word

option+left
send escape sequence
b

delete to beginning of word (credit)

option+delete
send hex code
0x1B 0x08

delete to end of word

fn+option+delete
send escape sequence
d

(I don't remember for sure, but I think I copied this answer from jherran's answer below and added more to it. I should have added the extra information in comments or suggested edits on that answer. I don't know how to improve the situation, but now it's known.)


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.