Text Expansion

I’ve been using a text-expansion utility almost every single day for the past couple of months. If you frequently repeat yourself while you type (i.e. you type similar things over and over), you could probably make use of an application that can expand shortcut text for you.

There are lots of utilities that provide this sort of functionality. This post does not compare utilities or offer advice on which one(s) to use; there are lots of reviews of different applications and you’ll want to choose one that meets your personal needs.

What is a text-expansion utility?

A text-expansion utility expands a shortcut into a larger snippet of text (or other media; here, I’m going to focus on text).

Let’s get into an example: say I want to type this text in quotes: “Are you there?” Normally, that’s 14 characters with two modifiers (shift for the capital letter and shift for the question mark).

Instead, I type just 3: ;yt. I use a semi-colon to prefix all of my snippets, then the characters after them are something that’s easy for me to remember. In this case, yt stands for “you there” and nicely expands to a full sentence.

Why you need text expansion in your life

These “snippets” of shortcuts that can expand into longer pieces of text are extremely useful if you type the same thing multiple times throughout your day.

Type your email address frequently? Use a snippet.

Use a common term in some text that you’re writing? Use a snippet.

Work as a programmer and have commands that you use frequently? Use a snippet!

How I use them

As a regular computer user, there are a few things I type pretty frequently:

  • My email (both personal & work)
  • My phone number
  • My address

As a software developer, there are a couple other things that I type regularly:

  • Terminal commands
  • Common/boilerplate code

There are also some less common things that I type but are handy to have:

  • Code for live demos
  • Bug reports

I can type all of these faster with a text expansion utility. For the common commands, I spend less time typing and type more accurately. For the less common things, I don’t have to remember the full text or copy it from somewhere else; instead, I can type the shortcut.

Advanced snippets

Expanding a small amount of text into a larger amount of text is nice, but maybe I haven’t sold you on the idea completely. Well, what if I told you that you could do things like use your clipboard in your commands to make them dynamic?

Does that catch your attention?

Let’s go through another example. Say I need to run this command:

git checkout -b branch origin/branch

branch changes values every time I use it, so sometimes it’ll be git checkout -b abc origin/abc or git checkout -def b origin/def

This is particularly tricky because while the command is simple, it has two parts where I need to have a common thing.

Most text-expansion applications allow you to mix your snippets with other sources. For the command above, I could copy the branch and then invoke a snippet (in my case, ;gco) to take the contents of my clipboard and use it in the expanded snippet.

This is just one example of how you can use a text-expansion utility to speed up tricky typing situations. Different applications have different advanced functionality that covers all sorts of use cases.

Why not use git aliases?

Developers that use git like to ask me why I don’t use git aliases. The answer is simple: I want one text-expansion utility for all of my snippet-expanding needs, no matter what application I’m using.