Word Movement in OS X Leopard Terminal.app

Word movement in OS X Leopard Terminal.app is a pain! After long time searching, I must keep the solution documented here.

I’ve been searching for a long time, how to fix home/end keys and how to jump words. In every OS X application, cmd + arrows and option + arrows would do the trick, except Terminal.app. I had once fixed it for OS X Tiger, but I couldn’t remember how…

Finally, I’ve found it. Thanks Textmate guys!

My choice is for fn + arrows (home/end) to begin/end of lines and ctrl + arrows to jump words. Fire your Terminal.app, hit cmd + , (yes, period); the alternative is Terminal -> Preferences. Go to Settings area, then Keyboard tab. Edit your combos as below:

Terminal.app keyboard settings

The trick is the code \033b. It is produced through esc (\033) + b and represents “move one word backward”. Forward movement is esc + f, home is ctrl + a (\001) and end is ctrl + e (\005).