Word Movement in OS X Leopard Terminal.app

15 Apr

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).

Advertisement

8 Responses to “Word Movement in OS X Leopard Terminal.app”

  1. howe0001 May 8, 2008 at 10:00 am #

    This is a good trick to know.. much appreciated. Another item I am trying to find is how to modify the word boundaries for text selection.. in iTerm, I can specify what characters make up words I want to click on to select. for example, if I have /dev/nst0 and click on that string “/dev/nst0″ in Terminal, it only selects “dev” or “nst0″, I need it to select “/dev/nst0″ so I can copy/paste. Any ideas on this for macs Terminal.app?

  2. Fabio Kung May 9, 2008 at 9:16 pm #

    No idea. I’m suspecting Terminal.app can’t do it. :(

  3. Ignacio December 28, 2008 at 5:16 am #

    Nice and very useful post. Thank you!

  4. sequoia mcdowell August 10, 2009 at 11:37 am #

    Yay! Thank you for picking up Apple’s slack… how could they overlook something like this?

  5. Gunnar Radiko September 22, 2009 at 7:33 am #

    Thanks! But I’m having trouble finding the control cursor right to show up in the list of keys. I only have the control cursor left there, how do I get more keys to show in the list?

    Regards

    /Gunnar

    • Erik May 13, 2011 at 12:53 am #

      I know 2 years later, that it may be very too late to answer :)

      I had two Control cursor left, although it was in swedish “Kontrol markör vänster”. In order for it to work I had to set the primary language under “Language and text” to English, log out and log in. In english and settings for Terminal.app I could set the Control cursor right.

      It is a bug in OS X, swedish, mayhap in other languages too, you have a nordic name, I just assume I hit the same bug as you.

      /Erik

  6. elmimmo September 25, 2010 at 6:24 am #

    Does not work when running vim inside Terminal.

Trackbacks/Pingbacks

  1. Cursor Movement in Terminal.app 2.0 | danielhaus.de - July 30, 2008

    [...] If you’re using Terminal.app a lot, like I do (I switched back from iTerm with Leopard because it finally has tabs now and other useful features), you want to read Fabio Kung’s post about “Word Movement in OS X Leopard Terminal.app“! [...]

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

Please log in to WordPress.com to post a comment to your blog.

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.