TextExpander abbreviation design
March 15th, 2010 at 12:17 pm
You’ve probably seen Merlin Mann’s little screencast about TextExpander 3. He does a nice job of showing dynamically what I tried to show statically in this post: TE3’s new feature that lets you define snippets with multiple fill-in-the-blank fields. Watching the video, I learned a couple of things about Merlin’s use of TextExpander:
- He has his abbreviations expanded immediately instead of using a delimiter.
- He uses simple abbreviations without any special characters.
Because I also have my abbreviations expanded immediately, I’m a bit surprised Merlin doesn’t use a “signal character” to distinguish his abbreviations. Let me explain what I do and why.
First, delimiters. TextExpander’s Preferences give you the option of expanding snippets as soon as you finish typing the abbreviation or waiting until you’ve typed a delimiter.

A delimiter is typically a “word-ending” character: a space, a tab, or any one of a number of punctuation marks.

The idea behind delimiters is to keep TextExpander from doing an expansion sooner than you want it to. For example, a natural abbreviation for “TextExpander” is “te,” but if you have that as your abbreviation and you use immediate expansion, you’d never be able to type a word like “tell”—as soon as you hit the “e,” TextExpander would do the expansion, and you’d end up with “TextExpanderll.” Using delimiters, the expansion will only occur when you type “te” as a separate word.
Unfortunately, forcing TextExpander to wait until a delimiter is typed isn’t a complete solution. Depending on context, “te” might make a great variable name, and if I wanted a program line like
te = sys.argv[2]
TextExpander would turn it into
TextExpander = sys.argv[2]
You can tell TextExpander not to expand abbreviations in certain applications, but that does me no good, as I write both regular text and programs in the same application. (At the beginning of Merlin’s screencast, you see that he uses “sdate” as one of his abbreviations. That’s an even better variable name than “te.”)
Also, I have TextExpander fix some of my common typos. I have an “hte” snippet that expands to “the.”1 By using immediate expansion instead of delimiters, that snippet works to correct “htere” and “hten” as well as “hte” itself.
So, since delimited expansion doesn’t get me what I want, I use immediate expansion and a trick. The trick is to always start my abbreviations with a semicolon. There are no situations in my writing or programming in which a semicolon will be followed by anything other than whitespace. In English, a semicolon is always followed by a space; and in programming it’s almost always a statement delimiter—illegal to use in a variable name. Yes, most languages allow you to squeeze statements together,
a=5;b=6;
but that’s not considered good style unless you’re doing a Perl one-liner on the command line. It’s not something that comes up in my programming.
The semicolon is the perfect special character for abbreviations not only because of its use in English and programming, but also because of its position on the keyboard. It’s one of the home keys and it doesn’t require a Shift. Typing it is almost effortless.
With my system, an abbreviation like ;te works perfectly, as do abbreviations like
;bill, which gives me the fill-in-the-blanks expansion I showed in my earlier post;apple, which expands2 to the Apple character, ;shift, which expands to the Shift key character, ⇧;times, which expands to the multiplication symbol, ×
These are, I think, the natural abbreviations to use, and because they are real words, they wouldn’t work as abbreviations if it weren’t for the leading semicolon.
I know I’m not the only one who does this. I’m pretty sure I once saw a Twitter exchange between Jason Snell and John Gruber in which they each learned that the other used leading semicolons. When I saw that, I knew I was in good company.
Sadly, the semicolon trick is a poor match for the iPhone version of TextExpander because the semicolon key isn’t on the iPhone’s main keyboard. The few snippets I have on the iPhone—mostly date and time stamps—use a trailing “z” to distinguish them from real words. It’s not as good as the semicolon trick, but it works with a limited number of snippets.











March 15th, 2010 at 3:48 pm
I’ve always liked doubling up the last character in my abreviations. For example, if I type “sff” Text Expander drops in San Francisco. When I type “gmm” I get my Gmail address. “datee” gives me a date format I like. You get the idea. This seems like the easiest thing to type seamlessly.
Erik
March 15th, 2010 at 8:31 pm
Erik,
That’s a good strategy, and one that would work fine on an iPhone, too. One can come up with ways to make it fail—the “te” example in my post would still be a problem if it were “tee”—but I’m sure you can work around those problems.
I’ve been using the semicolon trick for so long, my right pinky automatically pushes down as soon as I think of invoking a snippet.
March 20th, 2010 at 8:53 am
For all CSS lovers out there: TE has a built-in CSS group that has “;” as its first character. For example, typing “;bgimage” expands to “background-image: ;” with the cursor positioned right where you want it. Try “;a”, a great time-saver. : )
Thanks for an excellent article!
March 20th, 2010 at 1:01 pm
I probably don’t say it often enough, but, gosh, I love your site. Truly, one of my favorites. You are really awfully good at explaining and expanding on at least half a dozen topics I thought I understood. :-)
Another great one, Doc. Thanks for this, and please consider becoming my personal life-improver.
March 20th, 2010 at 3:58 pm
ProfMac, thanks for the tip. I confess I’m not up to speed on TE’s programming snippets, as I’m more comfortable using the similar features in TextMate.
Shucks, Merlin, ’tweren’t nothin’. As for becoming your personal life improver, I believe Alyssa Gregory is lobbying for that position, and I wouldn’t want to get between the two of you.
March 21st, 2010 at 1:35 am
Dear Dr. TextMate, copy that. I see Ted Forbes and Chris Coyier working in TM and I can tell how quickly one can adapt to the in-app shortcuts. Espresso has a lot of the same stuff, no doubt a nod to its more established “competitors”. For those times when I’m coding outside my comfort zone—and have access to TE—the CSS group is nice to have by your side. *On a personal note: what a thrill to have Merlin Mann’s post right after mine!!! I’m a big fan. : )
March 21st, 2010 at 8:38 am
Fantastic post and now I have a new technique to apply today. I do not see RSS on this site so I can subscribe to it. Am I just missing it? I’d love to just have it on my reader.
March 21st, 2010 at 2:07 pm
Victor, the feed URL is http://www.leancrew.com/all-this/feed/
I stopped putting a link to the RSS feed on the site itself when it seemed like every browser could pluck the feed URLs from the
<meta>tags. My copies of Safari and Firefox, for example, put an RSS button at the right end of the toolbar’s URL field.Am I wrong about this? Are there browsers that don’t recognize the
<meta>tags? I can always put an RSS link in the sidebar.