I use PINE as my email client.
“Why are you living in the late 1970s?” you ask.
But I’ll refrain from answering that question for now. And I’ll even refrain from correcting you in that PINE wasn’t available until 1989.
And, so, in fighting the ongoing war against email, I tend to spend a lot of my day interacting with Mac OS X’s Terminal.app. I SSH into one of our Fedora Core Linux servers and run PINE there.
The default keybindings used by Terminal.app leave a bit to be desired, however
— particularly when editing in a visual editor such as PINE’s PICO. Home, End, Page-Up, and Page-Down — as is typical on Mac — all modify the viewport, but not the location of the cursor. And, coming from using X-Window on Linux for the last twelve years, I’m a bit frustrated when pressing Home whisks me to the beginning of the Terminal.app buffer, rather than the beginning of the current line I’m editing.
It’s actually pretty easy to modify the Terminal.app keybindings — go to Terminal / Window Settings / Keyboard — but you need to know the right escape sequences.
Here’s what I find useful to replace:
| Key | Escape Sequence |
|---|---|
| End | \033[4~ |
| Home | \033[1~ |
| Page-Down | \033[6~ |
| Page-Up | \033[5~ |
| Page-Up / Page-Down Before: | Page-Up / Page-Down After: |
Much better.

It’s important to note here that you cannot simply type “\033” to get the escape character. Typing ‘' gives you 2 backslashes in the box: “\”. To get the \033 part you need to press escape (esc) or type \033 and then use fn-delete to remove one of the extra slashes.
Submitted by cwright on 2007.05.12 @ 08:44. |
I am Agree with you!
Online Casino Novoline SEO
Submitted by seotrabajo (not verified) on 2010.03.08 @ 19:43. | Re: Agree
Right. Also, you can just cut-and-paste from the table above, or from another keybinding entry.
Submitted by smokris on 2007.05.12 @ 08:47. |
I’m a Mac user, and although I haven’t used Pine in a few years, I loved it when I did, especially its “select” functions and automatic monthly archiving. Found your page while looking for a way to get page up/page down to work after a terminal window has exited, and although this isn’t that, I can think of a few places this tip could come in handy. Thanks!
Submitted by Krishen (not verified) on 2007.06.19 @ 08:41. |
The page-up/page-down thing is driving me crazy, too. I’m using OS X 10.2.8, and there is no “Keyboard” option under Terminal, Window Settings (I am guessing because this was added in a newer version of Terminal). Do you know of another way to change the keybindings?
Submitted by Eugene Morgan (not verified) on 2007.08.07 @ 09:04. |
Eugene -
Yikes, I haven’t used 10.2 for three years.
On 10.4, Terminal.app stores its preferences in ~/Library/Preferences/com.apple.Terminal.plist. Inside, there’s a “KeyBindings” section. It looks like page up and page down are keys “F72C” and “F72D”, respectively. If these keys exist in 10.2’s plist, you might be able to set their values to those I described in the original post.
Steve
Submitted by smokris on 2007.08.07 @ 10:45. |
the home and end values in the table do not work for 10.5. check out the shift-home and shift-end.
Submitted by richard (not verified) on 2007.11.06 @ 08:06. |
on 10.5 I got this from infocmp (good old terminfo utility):
$ infocmp -L|grep cursor cursor_address=\E[%i%p1%d;%p2%dH, cursor_down=^J, cursor_home=\E[H, cursor_left=^H, cursor_right=\E[C, cursor_up=\E[A, delete_character=\E[P, parm_down_cursor=\E[%p1%dB, parm_left_cursor=\E[%p1%dD, parm_right_cursor=\E[%p1%dC, parm_up_cursor=\E[%p1%dA, restore_cursor=\E8, save_cursor=\E7, scroll_forward=^J, $
which means: use \E[H for home key
Don’t ask me why the end key is missing in terminfo.
Submitted by Jürgen Jatzkowski (not verified) on 2008.03.24 @ 03:34. |
I found the codes for the end key: \E[F
Submitted by Jürgen Jatzkowski (not verified) on 2008.03.24 @ 03:36. |
Thank you, thank you very much !
I was looking for it for many hours, that’s work perfect.
Do you know if I is possible to change the Tab’s moving keys. Actualy Terminal.app use Cmd+Alt+( and Cmd+Alt+), I prefer to use Shift+LEFT and Shift+Right if it’s possible.
Thank’s again.
Submitted by giviz (not verified) on 2008.08.05 @ 11:37. |
Thanks so much! This makes os x livable for me.
Submitted by Joshua Rodman (not verified) on 2008.09.19 @ 09:59. |
Also you should consider mapping other commands to move the cursor. I found this (http://henriquebastos.net/post/the-complete-keyboard-mapping-for-leopards-terminalapp) terminal configuration quite convenient. []’s!
Submitted by Henrique Bastos (not verified) on 2009.01.08 @ 15:05. |
on 10.5.6 I needed to use the (esc) key in order to get the escape command for the home and end keys, and then use the modifier as per Jürgen’s comments above. So home became: 33[H And end became: 33[F Copy and paste does not always work, so the (escape) key function is useful.
Submitted by pneuma (not verified) on 2009.03.13 @ 23:23. |
Here’s the thing that’s making me crazy: cmd-w in Terminal kills the tab. ctrl-w in pine searces for stuff in your email. I keep accidentally killing the Terminal tab in which I’m running pine. How do I change this key binding in Terminal, I wonder. Sigh…
Submitted by ada (not verified) on 2009.04.22 @ 16:01. |
Thank you very much - as a PC user coming over from using Putty this is a godsend! Ta!
Submitted by Anonymous on 2010.05.22 @ 02:20. | Re: Keybindings in Mac OS X's Terminal.app
another way to get pageup/pagedown:
shift-fn-command up/down
Submitted by Anonymous (not verified) on 2011.05.26 @ 17:13. | Re: Keybindings in Mac OS X's Terminal.app
You are my hero - end/home Mac native bindings drive(d) me absolutely nuts. thank you, thank you
Submitted by Anonymous (not verified) on 2011.12.12 @ 21:48. | Re: Keybindings in Mac OS X's Terminal.app
Post new comment