Apple’s Terminal on a Macbook requires a weird combination of fn+shift+left/right, fn+shift+up/down to get Home, End, PgUp and PgDn to work. And that still causes issues in a couple of places.
Despite maintaining my philosophy of “use defaults wherever possible”, I’ve decided to ditch iTerm and iTerm2 for a simple reason: after quitting from Apple’s Terminal, upon restart in Lion I get a screenful of information from my previous session. Quite handy if I had to restart a machine for some reason, but I don’t want to lose the context!
Here are two fixes found Francois Planque’s post.
First part involves fixing the escape sequences sent by the Terminal. Open Preferences (for example, by hitting Cmd+,), and navigate to Settings tab, then for the profile you want to adjust, navigate to Keyboard tab.
Over there, define the following escape sequences upon pressing home, end, page up and page down:
page up: \033[5~
page down: \033[6~
If you mess up something during input, use your mouse to hit the button “Delete one character”. To get \033 in the dialog box, just press the Escape key instead of typing backslash, zero, three, three.
After applying this, voila! vim and mc now type these keys correctly.
But, you’ve just messed up bash.
Second fix involves editing ~/.inputrc (or /etc/inputrc). Neither of these rc files existed on my machine. From Garret LeSage‘s blog post (and as suggested in a comment on Francois’s blog), I simply copy pasted the following:
set completion-ignore-case On
It’s nice to see an OS X-related tech post that’s still as useful in 2012 as it was in 2005. And it’s even nicer to see that it was originally intended for other UNIX and UNIX-style systems.
By the way: this post’s ID is 2 * 333. Make of it whatever you want. 🙂