Capitalize macro for TextMate

I have a typing problem: my pinkies tend to lift off the Shift key before I hit the key I want to capitalize. I usually recognize the problem a few keystrokes away from the mistakenly-uncapitalized letter, and have to back up to capitalize it. (I will not do as many Internet writers do and leave things uncapitalized—I am not e.e. cummings or archy the cockroach.)

So with every text editor that I plan to use as my “permanent” editor (i.e., one that I expect to use for more than a few weeks—I am quite promiscuous with text editors) I figure out a single-keystroke way to capitalize the word I am currently typing. I’ve done it with NEdit, Emacs, Vim, BBEdit, and the time has come to do it for TextMate. Here are the keystrokes for the macro:

  1. Option-Shift-Leftarrow. This selects the word or partial word to the left of the caret.
  2. Control-Option-U. This is the keystroke equivalent of TextMate’s Text:Convert:to Titlecase menu command, which capitalizes the first letter of the selection. (The behavior of this command is much richer than I have described, but this is what it does when a single word is selected.)
  3. Rightarrow. This puts the caret at end of the selection and deselects, which puts me right where I was before invoking the command.

I recorded these keystrokes ( Automation:Start Macro Recording ) and saved the macro as “Capitalize” in the Text bundle (see update below).

It’s often difficult to decide on the appropriate keystroke for new commands like this. Control-C seems like a good choice, but I’m trying to limit my use of the Control key because I’m often working on an iBook, and I get the Control and Function keys mixed up. Also, this is such a common command for me, I want invoking it to be as simple as possible. So I chose F4 for the Key Equivalent. This may conflict with another bundle’s F4, but it’s been working so far.

Update: I just did this for my laptop and found that there was no “Text” bundle, instead there was a “Text Utilities” bundle. Not a big deal, but I can’t figure out how I saw it as just “Text.”