Word jumping in iTerm2 or Terminal in OSX Lion

MacosTerminalKeymapping

Macos Problem Overview


I recently upgraded from Snow Leopard to Lion and Xcode 4.1, and word jumping stopped working in both Terminal and iTerm2. Did the mappings change?

This is with and without a homebrew installation of readline.

My .inputrc looks like this:

"\e[1;5D": backward-word
"\e[1;5C": forward-word

Thanks!

Macos Solutions


Solution 1 - Macos

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 - Macos

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 - Macos

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 - Macos

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 - Macos

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

Solution 6 - Macos

Following the steps listed in the above answers, I found that on my laptop the first bash (1.bash) will not be able to jump words by pressing option + arrow. Instead, it will simply type in "[D","[C". However, if I create a new bash window (2. bash), the word jump works.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCarsonView Question on Stackoverflow
Solution 1 - MacosNikView Answer on Stackoverflow
Solution 2 - MacostypingduckView Answer on Stackoverflow
Solution 3 - Macosbest wishesView Answer on Stackoverflow
Solution 4 - MacosCarsonView Answer on Stackoverflow
Solution 5 - MacosOlivier RefaloView Answer on Stackoverflow
Solution 6 - MacosThomas ChenView Answer on Stackoverflow