Productivity software

Favorite text-expansion tricks

Text-expansion utilities let you create abbreviations—also called clippings or snippets—for frequently typed text. When you type one of these abbreviations, the utility automatically replaces it with the respective full text. Snippets can be words, phrases, sentences, paragraphs, or even bits of code. For example, when we type mw, our text-expansion utilities expand those two letters to Macworld, saving a few keystrokes each time. When Dan types addy, his utility immediately replaces it with his home address. While the keystrokes these abbreviations save may not seem like much on their own, the hundreds—or even thousands—of keystrokes you avoid add up every day. In this way, a text-expansion utility can save you significant time and effort.

Two of our favorite such utilities are Smile’s $35 TextExpander for Mac ( ) and Ettore Software’s $27 TypeIt4Me ( ). The two programs are quite similar, and each uses a similar procedure for setting up abbreviations: In TextExpander, you open the program’s main window and click on the New Snippet (+) button; then you enter your full text in the large section of the right-hand pane, and your abbreviation at the bottom-right of the window. You can also name your abbreviation (for example, Home Address) to make it easier to find in TextExpander’s lists. In TypeIt4Me, you open the program and click the New Clipping (+) icon; then you enter an abbreviation in the left-hand column and the expansion text in the right-hand side of the window.

But how can you use a text-expansion utility to increase your day-to-day productivity? Here are a few of our favorite tips for TextExpander and TypeIt4Me.

The basics

Start simple. Set up abbreviations for things you frequently type: Your full name, your address, your phone number, and even your favorite email signatures. You type these things frequently enough that you’ll start using their abbreviations—and being more productive—quickly.

Online shopping shortcuts Mac users can use Safari’s auto-fill feature or 1Password to automatically fill credit-card numbers and addresses when shopping online, but some sites actively prevent these tools from working—plus there are times you may need to provide that information in other apps. You can set up a snippet for each of your credit cards and use those snippets to paste your credit-card numbers on demand—it’s a lot easier to remember ccamex (for an American Express card) or ccmc (for MasterCard) than each card’s number. (Note that you probably don’t want to use these snippets on a laptop that you travel with, or a public computer, as anyone could read your credit card number by opening the text-expansion program.)

If you find yourself often filling out forms with, say, your name, address, and phone number, you’ll generally find that these forms have the same number of fields. It turns out that TextExpander and TypeIt4Me allow you to include tab characters within snippets, so you can set up a snippet in the format name, tab, street address, tab, city, tab, zip code, tab, phone number. As long as the fields are in the correct order, that snippet will let you enter all the information with just a few keypresses.

Faster site searching If you frequently search a specific website, you may know that you can use Google to search just that site using the syntax site:[sitename] [search string]. You can use this trick along with a text-expansion utility to create site-search shortcuts. For example, we search Apple’s Support site (support.apple.com/kb/) frequently enough that it makes sense to have a shortcut for this search. Dan has set up a snippet for site:support.apple.com/kb/ (with a space at the end) and given it the abbreviation kbs (for Knowledge Base Search). Whenever he’s in his browser’s Google-search field, or on the Google site, he can type kbs Lion Recovery, for example, to search Apple’s support area for information about Lion Recovery. (There’s a space at the end of the clipping so you can start typing after it is expanded, and your typed text won’t be appended to the URL.) Make similar snippets for other searches you perform often.

TextExpander for Mac
Add a new snippet in TextExpander using the program's main window.

Advanced expansions

For advanced users, both programs also let you create snippets containing AppleScripts, and TextExpander even allows shell scripts. TextExpander’s included Internet snippets include several AppleScript snippets that take the contents of the clipboard—presumably a URL—and process them using the tinyurl.com, tr.im, or bit.ly shortening service in order to get a shorter URL.

TypeIt4Me
TypeIt4Me has a similar interface. Add a new clipping in this window.

Another example, which Dan mentioned in his 2009 review of Plain Clip, is to use a TextExpander shell-script snippet to process clipboard text. (If you’ve downloaded Plain and placed it in your main Applications folder, you can access Plain Clip’s functionality via shell scripts.) Specifically, the following shell-script snippet (which Dan named ptp, for plain-text paste) takes any text on the clipboard, strips it of all formatting, and then pastes it in the current program, replacing the snippet’s abbreviation:

#! /bin/bash /Applications/Plain\ Clip.app/pc -i -w pbpaste 

Alternatively, this version of the shell-script snippet (which I’ve named qtp, for quoted-text paste) performs the same format-stripping action but pastes the resulting text with each line prepended with a quote (>) character:

#! /bin/bash /Applications/Plain\ Clip.app/pc -i -w pbpaste | perl -pe 's/\r\n?/\n/g' | fmt -m -n -p | sed -e 's/^/\> /' 

The magical %| and %clipboard or ⌘

Finally, don’t miss these critical shortcuts for your text-expanding utility: the %| and (in TextExpander) %clipboard or (in TypeIt4Me) . These are perhaps the most underused features of both TextExpander and TypeIt4Me. In each utility, including %| in a snippet tells the utility that it should place the cursor at that specific location—rather that at the end of the snippet—after expansion. In other words, if a snippet is Thanks for the email, %|. It's good to hear from you., once you type your abbreviation (say, thxmail), the cursor will be positioned immediately after email, so you can type the person’s name. This trick is great for creating snippets where you need to manually add text.

Similarly, including %clipboard (in TextExpander) or (in TypeIt4Me) in a snippet tells the respective utility to paste the contents of the clipboard at that location when expanding the snippet. This is an essential tip when you want to use, within a snippet, text you’ve copied or cut.

You can use this snippet trick to quickly create HTML or Markdown code. For example, in TextExpander, you can set up the clipping <a href="%clipboard">%|</a> (or, if you write in Markdown, [%|](%clipboard)) and assign it an abbreviation. To create a URL link, you just copy a URL in any application, then type your clipping (Kirk uses hrf, Dan uses urlc), and it will be expanded to <a href="URL"></a> (or, for Markdown, [](URL)) with the cursor automatically positioned for you to immediately type the name of the link. TextExpander comes with a number of pre-defined groups of snippets, including a long list of HTML and CSS snippets that can save you a lot of time if you write Web code.

Dan Frakes is a Macworld senior editor. Senior contributor Kirk McElhearn, the author of Take Control of Scrivener 2, writes about more than just Macs on his blog Kirkville and on Twitter.

Products mentioned in this article

(2 items)

Subscribe to the Apple @ Work Newsletter

Comments