Article
How I use TextMate
After switching from TextWrangler sometime last year, I very quickly adopted TextMate as my text editor of choice. From the moment I saw its clean UI, intelligent shortcuts, and elegant Projects implementation I was hooked.
I’ve been using TextMate daily — to write code, emails, blog posts, shopping lists, etc — for over a year now. So it should come as no surprise that I’ve customized my work environment and refined my processes to take advantage of TextMate’s remarkable flexibility.
Here’s how I’m set up.
ProjectLand
When you’re working in a TextMate Project, you can:
- Use Apple-T to open the “Choose File…” search dialog, then type the name of the file you want to open.
- Search the entire project easily (and quickly!) by pressing Apple-Shift-F.
- Create new files and folders right where you want them. No need for “Save” dialog boxes.
Most times I just drag a folder onto TextMate. This creates a temporary project with all of the usual benefits except one (that I know of) — TextMate won’t remember where you were if you don’t save your project.
So for my “everyday” projects (FeedBurner) I work out of saved .tmproj files. That way TextMate always remembers which files I had open when I come back after restarting or logging out.
Bundles
TextMate comes with a great group of Bundles installed by default. The HTML, CSS, Javascript, and Markdown bundles get a workout in my environment. I’ve made a few key changes to bundles that I can’t live with out:
- More/better HTML snippets. I created HTML snippets for
<li>,<ul>and a couple other tags I use all the time. I also enhanced the<div>snippet to better suit the way I work. - “Stupify Quotes” macro. Seems I’m always replacing curly quotes with straight quotes in source material (from Word or some such). So I made a quick macro that looks for curly quotes, em- and en-dashes and ellipsis characters and converts them to their ASCII/Markdown equivalents.
- Bundle namespacing. I keep my custom snippets and macros in a “John Zeratsky” bundle, so I can take them with me. (This is easy to do — just create a bundle, then move any customized bundle items out of their original locations and into your bundle.)
- FeedBurner Dev Bundle. We’re a Java shop, so I end up typing
ant deploya lot at work. I made a bundle with commands for compiling/deploying, restarting tomcat, and a few other common development tasks.
Keyboard Shorcuts
Bundles and projects and snippets and transformations are cool, but not if you can’t intuitively access these commands while you work. I’ve strayed from TextMate defaults and set up a group of custom keyboard shortcuts that work really well for me.
My shortcuts are all based around Apple-Option (you’ll see in a second). For whatever reason, I’ve always found the Apple-Option combination a really easy one for me — probably because I can hit both keys with my thumb.
I set up my core keyboard shortcuts like so:
- Apple-Option-/ “Wrap line/selection in comment.” This is TextMate’s default “comment” command. I just changed the key combination.
- Apple-Option-. “Close tag.” This is a default TextMate command and the inspiration for this whole crazy scheme.
- Apple-Option-, “Select Bundle Item.” I have trouble remembering more than a few keyboard shortcuts so I mapped this convenient combination to the powerful dialog that provides access to all relevant bundle items.
- Apple-Option-m FeedBurner Dev Bundle. This shortcut calls up all of the commands in the FeedBurner Dev Bundle I mentioned above. (So, after saving a change I can hit Apple-Option-m, then 1 to deploy my change locally.)
- Apple-Option-v “Paste from history.” This should be built into the OS, in my opinion.
- Apple-Option-c CVS Bundle. Thank god I found a CVS bundle! I trimmed down the menu so only the most relevant commands — update, commit, diff — show when I press this combination.
Fits like a glove
From day one, TextMate has fit my brain like a glove. Some say I’m obsessed… I prefer passionate.
Any TextMate fans out there?