Improved Arrow Key Key-bindings For OSX Terminal

When using Terminal it is sometimes useful to have your Page-Up, Page-Down, Home and End keys (the four arrow keys on Mac keyboards) function as you would expect. This is especially useful when using more or less to view text files or man pages. Unfortunately the default key-bindings for Terminal do not provide this. Here is a quick fix that works for me on OSX 10.5.6.

Setting key-bindings for Terminal

Setting the Page-Up key-binding in Terminal

Open Terminal then go to Terminal -> Preferences -> Settings -> Keyboard. Scroll down to find the key that you want to change and highlight it. Click the edit button at the bottom of the window. A new window will open like the one pictured above. Set everything as shown and replace the string to send to the shell with the appropriate one from the following list:

Key        Escape Sequence
End        \033[4~
Home       \033[1~
Page-Down  \033[6~
Page-Up    \033[5~

Enjoy.

  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Technorati
  • LinkedIn
  • RSS
  • Slashdot
  • Twitter

About Jason Job

I am a technologist, music producer and an obsessive student of the Internet. I create sound, write code and make things with electronics and microcontrollers. I work as a software developer and consultant and am currently focused primarily on mobile applications for iPhone, iPad and iPod Touch.
This entry was posted in OSX, hack. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>