I have a long history of inconsistently using title case. I never effectively internalized the rules and basically just did whatever felt right. That meant putting anything that felt like a minor word in lower case, but I’d always waffle over what felt like borderline cases: capitalizing with,1 words after colons,2 follow-up words in hyphenated phrases,3, etc.
In Episode 173: Fork the Universe of The Talk Show, Gruber and Snell talk extensively about title case, and John was good enough to link to an eight-year-old post about a Perl script to properly title case a snippet of text.
I figured this would be a good exercise in learning how to bind a Perl script to a keyboard command and then use it to clean up all the title case usage on this site.
- Fire up Automator.4
- Create a new Service.
- Search for Run Shell Script and drag it into the window.
- Copy John’s Title Case Perl script and paste it into the automator window.
- Change the shell to
/usr/bin/perl
, set up the script to run on selected text in any application, and save. - Now for key binding. Go to System Preferences → Keyboard → Shortcuts → Services. Scroll down to the Text group then select the new TitleCase service. Double click on none to bind it to a keyboard combo.5
Now I can ensure a uniform application of title case across all my posts by selecting the title in a text editor and mashing some very specific keys.
-
Previously There’s Nothing Wrong with the Electoral College ↩
-
At first Minimum-velocity Throw ↩
-
This is where a real how-to site would describe where to find Automator. I almost always use Spotlight to launch apps — exclusively so when not permanently pinned to my dock. ↩
-
John’s default is ⌘-⇧-T, but that was already bound to something else in my text editor, so I used the more complicated ⌥-⌘-⇧-T instead. ↩