Word jumping in iTerm2 or Terminal in OSX Lion

Solution 1:

Just add the escape sequences in iTerm settings as global shortcut keys.

Word backward (option-arrowleft):

a iTerm settings

Same with word forward, just use F.

Solution 2:

The easiest/quickest way I have found is under Profiles > Keys > 'Load Preset...' > 'Natural Text Editing'.

Then use the option key rather than the control key.

(iterm2 version 3)

Solution 3:

Killing a fly with a cannon:

  • Go to Preferences... > Profiles > Keys
  • Press Load Preset...
  • 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

source and credits https://apple.stackexchange.com/a/293988/330806

Solution 4:

mission control took over the same commands as word jumping. thanks to rob cowrie and nicholas riley for the heads-up on that.

Solution 5:

I added the following in my /etc/inputrc

# word jump on SHIFT left/right arrows
"\e[1;2D": backward-word
"\e[1;2C": forward-word

it works great