My favorite TextExpander snippets
If you asked Macworld editors to name their favorite utilities, many of us would mention TextExpander. If you type for a living, as we do, TextExpander—or a similar app such as TypeIt4Me or QuicKeys—quickly becomes indispensable.
As you probably know, TextExpander and utilities like it enable you to insert fixed bits of text—which TextExpander calls snippets—by typing in short abbreviations. So, for example, you could create a snippet called Date that inserts the current date whenever you type in an abbreviation (I use
.date) followed by a designated delimiter (I use the backslash key
). Once you start building a library of snippets, they quickly become an integral part of your workflow.
If you are already using TextExpander, I’m sure you already have an extensive library of snippets. But if you aren’t, or if you just got started, I thought I’d try to give you some idea of what you can do with the app, by showing you some of the snippets I use the most.
1) Email signatures
The first one is a classic application: Any little chunk of text you type a lot, things like phone numbers, email addresses, or in this case email signatures.
For example, I use a couple of different email signatures, depending on whom I’m mailing. I could use Mail’s built-in signature tools, but I find them clunky; doing it with TextExpander is a lot easier. So what I do is compose my email message, then at the bottom I type out the TextExpander shortcut for the email signature I want to use—in this case
.form—and it inserts my formal email sig.
2) Boilerplate text
Beyond small snippets, I also use TextExpander to insert blocks of boilerplate text that I use a lot. For example: the body texts of email messages that I have to send a lot, things like assignments to writers, requests for paperwork, or in this case the email I send to our copy editors when I’m submitting an article.
That form email is 15 lines long. I only use it a couple of times a month, but I’d still hate to have to type it out every time. So I made it into a TextExpander snippet.
3) HTML code generally
Because we publish things on the Web, we obviously write in HTML. I could hand-code everything, but that’s a hassle. Better to let TextExpander do it.
The key here is its ability to insert the contents of the clipboard—using a special TextExpander clipboard variable,
%clipboard—inside a snippet. What that allows you to do is to copy a bit of text, then hit a TextExpander shortcut, and it will paste that copied text inside a snippet—in this case, inside pairs of HTML tags. I’ve got snippets for paragraph tags, bold and italics, anchor tags, and other common bits of HTML.
4) Google operators
One snippet I use multiple times a day: A Google search operator—
site:macworld.com—that searches macworld.com. There are times when I want to find something on our site. I could navigate my browser to macworld.com and use our own search tools. But, because I use Chrome, with its unified search/address bar, I can instead just type whatever search term I’m looking for, followed by a TextExpander shortcut that inserts the Google operator
site:macworld.com. That then limits the Google search just to our site. You could do the same for any search operators you use most often.
5) Manipulating text
Finally, as I said before Macworld editors spend our work lives dealing mostly with text. Some of the time that means futzing around with the formatting of text we’re copying from one place to another. Again, there are lots of utilities that’ll help you do this. But, once again, TextExpander proves a handy tool for the job, in large part because it’s effective in any app you’re running.
So, for example, a lot of time I need to copy text from a webpage to another app. If I just do the usual Command-C/Command-V, that text could be pasted with all of its Web formatting intact. I usually don’t want that. Instead, I usually want to paste it as simple, plain text. There are plenty of tools built into various apps or third-party utilities that will do this paste-as-plain-text trick for you. But I learned a simple trick from David Sparks: You create a snippet consisting of just that
%clipboard variable I mentioned earlier. Then, after you’ve copied whatever text you want, you invoke that snippet (I use the shortcut
:plain). That pastes the copied text without any of its formatting. (Note that, for this to work, you should open TextExpander’s preferences and make sure the Default Snippet Format is set to Plain Text.)
I also use some snippets based on Perl scripts that I found on a blog called Thought Asylum. These scripts convert the case of copied text—so it’ll turn whateve you’ve copied to all lower case, all upper case, title case (every word capitalized), or sentence case (the first word of every sentence capitalized). It’s pretty handy.
The only limitation of using a utility like TextExpander is remembering all the abbreviations you’ve set up. I periodically go through my TextExpander library of snippets and delete the ones I don’t use and, while I’m there, refresh my memory of the ones I have. Otherwise, it’s a super easy utility to use—and one I couldn’t live without.