Wednesday, September 22, 2010

MacOS X Terminal Page Up/Down Fix

By default in the terminal application the “Page Up” and “Page Down” keys do not send an actual page up sequence to a session but are used to scroll the terminal buffer. I find this is not acceptable when I have to use programs that have their own buffer, like when I run an editor in a ssh session or I'm reading a man page.

This is how to get an x-term like behaviour:

  • Go to Terminal->Preferences->[Settings]->[Keyboard]
  • Find pg up, and pg down and change 'Action' to 'send string to shell:'.
    Click on the entry field and enter \033[5~ for Page Up
    and \033[6~ for Page Down. Remember that \033 is the Esc key!
  • Assign the buffer scrolling actions to Shift-Page Up and Shift-Page Down.

Other useful codes are \033[1~ for Home and \033[4~ for End.

No comments:

Post a Comment