Master TextExpander With These Helpful Tips & Tricks
If you're a TextExpander user, then you know that it can have a drastic positive impact on your productivity. But are you using TextExpander to its full ability or are you barely scraping the surface of what it can do? This tutorial takes a deep dive into this incredibly versatile tool and teaches you everything you need to know to become a TextExpander master.
The following tutorial is split up into four sections:
- Setup - Here you'll find some tweaks and changes that you can make to optimize your TextExpander experience.
- Trigger Advice - In this section, I share some general advice and best practices for setting up effect triggers to expand your snippets.
- Simple Tricks - We'll start off our TextExpander tricks with some features that seasoned users will likely be familiar with, but new users may have looked over.
- Advanced Tricks - We'll finish off with a look at some of TextExpander's most complex features and learn to use them effectively to save tons of time and effort.
In this section, we'll take a look at some of the ways that I set up and tweak TextExpander for the best possible experience.
Tweak the Clipboard Delay
One of my only peeves with TextExpander has to do with how it restores the clipboard. Often, I use it to wrap some existing text snippet in a tag. The process is as follows: First, I select something, then I cut it to the clipboard. Next, I type out my abbreviation for the tag that I want to use, expand it, then paste in the original piece of text, thereby wrapping it in the tag.
The problem is that, when I go to paste in the original text, things don't work out quite like I want. Here's an illustration of what happens:
A problem that I frequently run into
As you can see, what happens is that I end up pasting in the TextExpander snippet instead of the original piece of text that I cut to the clipboard. The reason for this cuts to the very core of how TextExpander works. What it does when you expand a snippet is place the expanded text into your clipboard, displacing whatever you had there, paste this expanded text where the cursor is, then restore the original contents of the clipboard.
What's happening in the example above is simply that I'm ahead of TextExpander. I hit Command-V too quickly. If I had waited a second or two, it would've worked fine. The problem is, I'm using this tool to save time, so I don't want to wait a few extra seconds!
It turns out, there's a way to tweak this functionality to work how you want it. Go into TextExpander's Preferences and make sure the first tab, "Expansion," is active. Now find delay the slider for "Restore clipboard" and move it to the left a bit.
A problem that I frequently run into
What this is doing is decreasing the time that it takes for TextExpander to restore your clipboard. Take caution though, if you take this slider too far down, the clipboard will be restored so quickly that your stored snippets won't get the chance to expand. I've found 0.45 seconds, down from a default 0.8 seconds, to be a good value, but this may vary for your setup. Try a few different values until you come up with something that works.
After tweaking this, if I run my experiment over again, I find that my problem has been solved. The original text is pasted in right where it's supposed to go.
Tip: Things can get a little screwy when you start messing with the clipboard delay. If you don't like the results you're getting, just hit the "Use Default Delay" button to return to the normal behavior.
The longer you own TextExpander, the more you'll find that it worms its way into your workflow so deeply that you almost can't imagine working without it. Before long, you'll have to purchase the mobile version as well so that you can access your snippets when you're working from your iPad or iPhone.
By default, when you download the mobile version, it will simply be an empty app. None of your groups or snippets will import from your Mac. This is also true if you set up TextExpander on another Mac. Obviously, you don't want to manually create all your snippets in each version, so what's the solution?
Fortunately, TextExpander includes two syncing options that have you covered. To check them out, open the TexExpander Preferences and click on the Sync tab. Here you'll be presented with the option to Sync via Dropbox or share your snippets over a local network.
TextExpander's Sync Options
The best solution here is to go with Dropbox. This will place your TextExpander library right in your Dropbox folder so that you can share that same library across all of your various iterations of the app, which ensures that all snippets, new and old, will be updated everywhere you need them.
TextExpander's Sync Options
To enable this in the mobile app, hit the little gear icon to bring up the Preferences screen, then simply toggle on "Use Dropbox". This will redirect you to the Dropbox app for confirmation, then back to TextExpander where you'll be asked to either "Link to Dropbox" or "Replace Dropbox Data". It's vitally important that you choose "Link to Dropbox" or you'll end up deleting all of the snippets that you worked so hard to create on your Mac.
If for some crazy reason you're not a Dropbox user, you can choose to share your snippets over a local connection, but this option is much more laborious. You have to select and approve each individual group of snippets for sharing, the re-sync every time changes are made. This is a real pain so save yourself the trouble and go the Dropbox route.
Make Daily Backups
One fine day after I restarted my Mac, I noticed that my TextExpander snippets weren't working. I cracked open the app to see what was up… and it was empty. Not a single snippet in sight. Given that I had spent months building up my library of snippets, a mild state of panic immediately kicked in. I'm honestly still not sure what happened, and it didn't really matter, all that mattered was that there was a big hole where the fruits of my labor had once been.
Once the panic subsided, cool heads prevailed and I remembered that I had once checked a simple little box in TextExpander's preferences:
Always, always, always perform daily backups.
"Perform automatic backups of TextExpander data: Daily." This amazing screen allows you to set how often you want backups performed, see where they are copied to, and set the number of backup files to keep on hand. It even walks you through the process of restoring a backup.
Because of this, my story has a happy ending. In mere seconds I was able to pull from the previous day's backup and had an app full of snippets once more. Go, right now, and make sure you have this window set up properly.
Let's talk triggers. As you know, snippets are triggered by something specific that you type, but not all triggers are created equal. I'll share some of my tricks for creating effective triggers.
Use Short But Memorable Triggers
The key to a good trigger is to make it super brief, yet instantly recallable. Make it as close as you can get it to whatever your first instinct would be so that even if you forget, the first thing that you're apt to try works out. That being said, remember that the entire point here is to save keystrokes. Triggers that take ten key presses to type out are simply inefficient and self-defeating, you can do better.
Consider the three examples above. The first one is great if you can remember it, but odds are you'll soon end up mixing up all of your super tiny triggers and eventually run out of letters anyway. The next example is much more memorable, but it takes far too long to type out. The final example is perfect, it says exactly what it does, so it's memorable, and is almost certainly still much quicker than typing out your actual email address.
Unique Trigger Ideas
For a trigger to be effective, it must be unique. By that I mean that it can't be something that you would ever normally type in your typical routine. For instance, you can't just use the word "email" to expand your email address snippet, because there are times when you're genuinely going to want to type the word "email" and will be furious when TextExpander keeps overriding it and turning it into something else.
Here are a few different techniques that I've seen people use to create unique triggers:
Unique trigger ideas
Double the Last Letter
The first example is super simple, but in my mind it's also the least effective. I find that choosing a one word trigger, then doubling the last letter can still lead to some occasional accidental triggering. For instance, let's say you create a trigger that writes out an "em" tag in HTML. Using this logic, your trigger will be "emm", which will definitely be problematic the first time you try to email someone named "Emmet" about a "dilemma" you've been having.
Use a Symbol
The next one is my personal system. I typically use a single word or abbreviation as a trigger, immediately followed by a hash symbol. Using this system, I never come across accidental expansions. However, it does admittedly require an extra key press as the "#" symbol requires "Shift". It's also not ideal for mobile snippets given that symbols are on a secondary keyboard menu.
Start with a Comma
One of the most interesting techniques I've seen is to begin each trigger with a comma. If you think about it, you probably rarely or never type a comma that isn't followed immediately by a space. This means that you can use a comma without a space to indicate that you're starting to type out a trigger. The potential problem that you run into here is that you can't have any triggers with similar roots. For instance, I use "ul#" to create an unordered list in HTML and "ula#" to create an ordered list full of anchor tags. If you tried this with the comma method, it would always expand once you typed out ",ul" and never give you a change to get to the "a".
In addition to creating unique strings of characters to trigger an expansion, you can optionally set up specific shortcuts or "delimiters" as triggers. Under the "Expansion" tab, you can set abbreviations to expand immediately when typed or at a specific delimiter. You can also choose whether to keep or abandon the delimiter after the expansion. In most cases, you're probably going to want to abandon it.
Unique trigger ideas
If you click the "Set Delimiters" button here, you'll be taken to the screen below where you can set up multiple delimiters, any of which will trigger an expansion.
Unique trigger ideas
In the example above, Space, Tab, Return and Enter are all set to trigger an expansion when the key word, phrase, etc. is typed.
Not for Sensitive Information
One of the places where I find myself having trouble remembering long strings is with passwords. There's a strong temptation when you first start using TextExpander to use it to help you recall the ridiculously complex codes that good security measures force you to use, but this is important: TextExpander is not for sensitive information.
There's a simple reason for this: it's not secure. If I sit down at your computer, I can pop up TextExpander with no effort. If you have a folder of snippets labeled "passwords," I've struck gold.
Use a password manager like 1Password for sensitive data
This goes way beyond passwords. Anything that isn't public information, from credit card information to your Social Security Number, should not be stored in TextExpander or any other non-secure application. For this type of data, use 1Password or some equivalent application that holds your information in a secure digital vault.
In this section, we'll look at some of the simple built-in TextExpander features that can make your life easier. If you're new to TextExpander, these tricks are super easy and have the potential to drastically change the way you use this application.
Place Your Cursor Where You Want It
One of the first things that you absolutely must learn to do in TextExpander is how to place the cursor where you want it after the expansion occurs. As an example, let's say you want to have a macro for creating a quick div in HTML. Your first instinct might be to place the code directly into your snippet and call it a day. However, you can do better than that:
Use %I to place the cursor where you want it after the expansion
As we see in the shot above, our div snippet needs an ID name. Every single time we use this snippet, we'll need to manually enter this information. The problem is that our cursor will always be in the wrong place, necessitating an extra click to get it where you need it. With our improved version however, we've inserted the cursor right where we need it after the expansion so that we can continue along and type this part in without missing a beat.
This is accomplished with a simple little code: %I. Place this in your snippet wherever you want the cursor to be placed and it'll pop to that spot instantly after the expansion.
You can insert the cursor short code with this menu
If you forget the code to insert the cursor, don't worry, you can use the menu shown above to place it into your snippet. This is found at the bottom of the snippet creation panel.
The same method that we just used to insert the cursor in a specific location can be used to insert the contents of the clipboard. This time around, we use the code %clipboard.
You can insert the cursor short code with this menu
Below, you can see the workflow for this in action. First, we grab a long number and copy it to our clipboard. Then we type the abbreviation to expand a snippet that has the %clipboard code in it. The result is that our original snippet is modified with the current contents of the clipboard.
A sample workflow for the clipboard function
Another useful time-saving technique is nesting one snippet inside of another. So let's say you already have a snippet for you email, then you create another larger snippet that also contains your email, you can simply insert the latter into the former with the following technique:
Nesting a TextExpander snippet
As you can see, you first need to type the word "snippet" followed by a colon and surrounded by percent signs (%snippet:%), then you insert the trigger for the snippet that you're referencing after the colon and before the closing percent (%snippet:email#%).
One of the benefits of this technique is that when you change your email address, you only have to update a single snippet. All of the others are referencing that single source and update with any changes you make.
Inserting a nested snippet with the menu
As with the other techniques above, you can insert a snippet with the menu at the bottom if you forget the manual syntax. This will simply type out the line of code above for you.
Change Snippet Type
One of the most important and easily overlooked features of TextExpander is the ability to change the "Content" type of your snippets. There are four different options:
- Plain Text
- Formatted Text, Pictures
- Shell Script
To change the type of snippet, click on the little horizontal drop-down menu that appears above the large snippet insertion field.
Click on the menu above the snippet field to change its type
The first two are pretty straightforward. By default, TextExpander snippets will be plain text, but you can also be very specific about the formatting, even going so far as to include images. One of the most common misconceptions about TextExpander is that you can't use it with rich text, but here you see that it's as simple as a quick change in this menu.
The really fun stuff begins when you realize that you can use TextExpander to trigger scripts. So rather than a small phrase turning into a big paragraph or something, you can instead launch a script that performs pretty much any action that you want. Your results are only limited to your scripting chops.
Finding Your Snippet
Can't remember the snippet that you're looking for? TextExpander gives you a bunch of different options for searching and browsing through your snippet library. The main interface obviously has your snippets on the left, and there's a search bar at the top right. Additionally, you can browse your snippets from any app right in your menu bar:
Browse your snippets from the menu bar
As you can see, there's also a search bar at the top of this menu. If you want to access that search bar without all the fluff, you can set up a keyboard shortcut in TextExpander's preferences:
Set a keyboard shortcut to search your snippets
First, click on the Hotkeys tab, then set a shortcut for the very bottom option: Search Snippets. Once this shortcut is set, your assigned key combination will bring up a simple search bar to help you find the right snippet.
Snippet search without the fluff
Seasoned TextExpander veterans likely know most of the tricks in the previous section, so let's dive into some more advanced techniques that you probably haven't tried yet.
Date and Time Math
I've known for a while that TextExpander was capable of time-related math operations, but until recently I had never really dug in to see how it works. It can be pretty complicated and difficult to wrap your mind around. For instance, here's a snippet that I use to automatically insert tomorrow's date:
This code outputs tomorrow's date
If you've ever performed date formatting operations in Shell Scripts, this will look familiar to you. Otherwise, it'll look like complete gibberish. Let's start with how to write out different portions of the date in various formats. Here are a few examples of code versus how the output looks:
- %a = Mon
- %A = Monday
- %b = Jan
- %B = January
- %d = 01 (day of month)
- %I:%M = 11:32 (current time, twelve hour clock)
If you're looking for a more exhaustive list, you can find one here. Note that you can insert any of these directly into a snippet with no math involved, but if you want to really get fancy, prepend these with some of the following.
- %@+1D (+1 day)
- %@+10D (+10 days)
- %@+1M (+1 month)
- %@+1Y (+1 year)
- %@+1h (+1 hour)
With all this in mind, we can easily analyze our initial snippet: %@+1D%A, %B %d. To start, we know that %@+1D will add one day to the current date. Next, we set the output format of this action: %A, %B %d. Using our list above, we see that this grabs the day of the week (Wednesday), then a comma, then the month (February), and finally, the day of the month (27). The final result is something like this: Wednesday, February 27.
We can do the exact same thing with the time, which is great for anyone who frequently has to convert time zones:
This code adds an hour to the current time
The last snippet added one day to the current date, this one adds one hour to the current time. If this is all too much to take in, don't worry, you can cheat!
The Easy Way
It's important to understand how the code above works in case you want to tweak it in any way, but you fortunately don't have to memorize all those crazy codes. In that same menu at the bottom that we looked to before, we find options for adding in Date / Time Math.
Use this menu to make date and time math easy
The process is a little tricky so make sure you get it right. If you try this out of order, it won't work.
- Start with a math function (add/subtract a day, month, year, etc.)
- Next, look under the Date or Time menu
- Define the date or time format by choosing from the options listed
- Add in spaces, commas and other special characters as needed
As you can see, you always start with the math function, then move on to define how that function's output will look. It may take you a few tries to get it right, try referring to my sample output above as a guide.
Fill-ins are an extremely useful feature that allow you to create snippets that require customization each time they're implemented. So for instance, say you have a generic email that you send regularly, but need to change the name each time you send it, you can toss the entire email into a snippet and set the name to a fill-in that accepts input each time the snippet is expanded.
There are four different types of fill-ins available in TextExpander: Single-line field, Multi-line field, Popup menu and Optional section. These are found in the same menu that we looked at before, located under the snippet entry field.
Four types of fill-ins
You can use fill-ins individually or together. To see how each works, let's take a look at one big example that uses all four types of fill-ins. After I set up the snippet, I type my abbreviation trigger and this is what pops up:
Fill-ins in action
What I've done here is create a sort of template for a section of HTML. It contains a heading, paragraph and image, each of which has one or more customizable pieces. Let's walk through each piece individually:
- For the text of the heading, I used a simple single-line field that allows me to fill out the text. Each time I run this snippet, the HTML part will stay the same, but I can change what my headline says.
- The paragraph is similarly customizable, only here I've used a multi-line field that allows for much more text.
- Back up to the heading, I've tossed in two drop down menus that allow me to choose the type of heading that I'd like to use (h1, h2 or h3). Once I inserted the first one, I copied and pasted the code for the second one. This makes it so that the two always share a value. Change one of them to "h3" and they both update simultaneously.
- The optional section gives you a checkbox that toggles a piece of text that you may or may not want included. Here I've inserted a link into my image tag. Sometimes I'll want the image to link somewhere, sometimes not. If I don't want to include that piece of code, I simply uncheck the box.
TextExpander holds your hand and uses simple visual controls to walk you through setting up fill-ins, so I don't recommend that you spend too much time stressing about the code behind them, but if you're interested, here's the code for the example above.
<%fillpopup:name=heading:h1:h2:default=h3%>%filltext:name=headline%</%fillpopup:name=heading:h1:h2:default=h3%> <p>%fillarea:name=paragraph%</p> <img src="%filltext:name=image source%" alt="" %fillpart:name=link:default=yes%<a href="#">Click Here</a>%fillpartend%>
After reading this guide, you should have a downright impressive grasp of TextExpander's features, from simple setup tweaks to advanced functionality. Now it's time for you to teach me something new. Leave a comment below with your own TextExpander tip, trick or use case. I'd love to see how you use this awesome app to boost your productivity!