Option-Arrow Word Movement in Terminal

Want to use the option-arrow key combo to move through text in Terminal just like you do in virtually every other Mac application on the planet? Boy, I sure did. Luckily, Allan Odgaard, the author of TextMate, has figured out how, and it's a breeze. In a nutshell (no pun intended):

  • Open Terminal
  • Open the Inspector (command-i)
  • Go to the "Keyboard" section
  • Add a new key binding by pressing the "Add" button
  • Set "Key:" to "cursor left"
  • Set "Modifier:" to "option"
  • Set "Action" to "send string to shell:"
  • In the text box, press the escape key to get the "\033" text, then hit the "b" key, for "back"
  • Click "OK"
  • Repeat this process for forward movement, using "cursor right" for the "Key:" setting, and "escape-f" for the forward key binding
  • Be sure to click "Use Settings as Defaults" if you want the change to be permanent

The Terminal Inspector: Finally Proper Word Movement

(click for larger view)

That's it! Now hitting option-left-arrow will move the cursor back one word in Terminal, and, of course, option-right-arrow will move it one word forward.

Sweet!