Friday, June 09, 2006
Page Up/Page Down and moving the caret in Textmate
If you checkout the TextMate docs in section 16.3 "Text Move / Edit Actions", you'll see:
The master set of keys can be augmented by ~/Library/KeyBindings/DefaultKeyBinding.dict. The most common request with respect to key bindings is to have page up/down move the caret, and have home/end go to the beginning and end of the line. This article shows how this can be done.
You then arrive and discover that the article makes mention of the common request made to have the caret move with a page up/down and then immediately discusses that the article will provide an example for windows switchers where the home/end keys move to the beginning/end of the line respectively. Luckily if you read the article closely enough you'll see that he also provides an example for page up/down.
Turns out that the default key bindings in OSX do not move the caret on a page up/down. So the quick fix is to make sure that you create a blank file (unless you have already created a key binding file, then skip this step and just add the bindings below) called: ~/Library/KeyBindings/DefaultKeyBinding.dict
Then simply add:
/* page up/down */
"\UF72C" = "pageUp:";
"\UF72D" = "pageDown:";
to that file. Save it. Restart TextMate and voila! when you page up/down the caret will move with the scrolling activity.
My e-mail is email@example.com