FREE! Plan Your Ideal Week: Bonus Workshop + Planner  →  Get the Workshop

How to Create Text Snippets in Alfred

I had my first taste of text snippet expansion way, way back when everyone could use TextExpander without the subscription cost. There was a little bit of magic every time one of those snippets expanded. It was even cooler when you triggered a little dialog box that let you type in a custom bit of text to be added into the text expansion.

TextExpander was one of those apps that made me feel like king of my Mac.

TextExpander is still around, of course. But its feature set and price likely align it more for power users than for casual users like myself.

So off you go on the hunt for an app to either replace TextExpander or to jettison text expansion habits out the door entirely.

For a long while, I was able to go the jettison route — most of my text expansion needs were trivial and I could get by without the helpful workflows.

But new processes at the office this tax season instantly led me into Alfred 4’s text expansion features.

Boy was I impressed with what I found.

Alfred can do just about anything, it seems. A quick search can bring up any file or folder on your Mac. Added workflows can control music playback, or insert a password from 1Password, or find a Bible verse instantly. And, of course, text expansion.

Here’s how I set up and used Alfred 4’s text expansion features this past tax season to save myself oodles of time typing out the same file types over and over again.

What is a Text Snippet?

Really quickly before we get into the weeds, we need to answer the ultimate question: What is a text snippet?

A text snippet is a series of letters or punctuation you type that trigger an app like Alfred to instantly replace the text with a longer set of saved text. For instance, I have a text snippet saved for renaming client tax return PDFs. When I type t1c, Alfred sees the text and instantly replaces the text with T1 Client Copy – 2021.

Text snippets are best used when you have tedious-to-type information over and over again, like your address, generic emails, or file naming conventions. I use text snippets specifically for file naming conventions, but I also have a specific email I send to clients about 50 to 100 times a year saved as a text snippet as well.

Text snippets can save you so much time. They are a perfect example of one of those easy-to-automate tasks that can pay dividends instantly.

How to Create Text Snippets in Alfred 4

First, you’ll have to open Alfred’s preferences. I do this by hitting ⌘ + Space (which I’ve hot-wired to replace the built-in Spotlight Search). Navigate to Features in the left sidebar and click Snippets halfway down the menu.

In this window, you can set a variety of settings before creating your first snippet.

* Viewer Hotkey: Here, you set the keyboard shortcut for Alfred to show all your text snippets in a long list. I have mine set to ⌃ + ⌥ + ⌘ + J.

* Snippet Keyword: Sort of the same as the Viewer Hotkey, you can hit ⌘ + Space to bring up Alfred’s query field and type “snip” to bring up the same window as the Viewer Hotkey. The Viewer Hotkey takes you straight there while the Snippet Keyword is one extra step.
* Automatically expand snippets by keyword: Make sure this box is checked to ensure your text snippets work.

At the bottom of the window, you’ll find a box on the left showing all your collections and a box on the right that stores all the snippets for that collection.

The Default Collection is likely where you’ll keep all your custom snippets, but it’s cool to know you can separate like-snippets if you need to. You can also click Get Collections to download some frequently used snippets from the web. I’ve installed currency snippets and Mac-specific snippets to expand fun symbols like ⌘, ⌥ and ⌃.

You can double-click the collection in the right box to set a specific prefix for all the snippets in the collection. So if one collection uses !! and another uses ::, you can set the prefix once rather than individually for all the snippets in the collection.

To create a new snippet, click the + button on the bottom of the right box. Up pops a dialog box which you can name, create a snippet, change the snippet’s collection, change some settings for the snippet, and input the text to expand when the snippet is triggered.

A few tips for creating a new snippet:

  • Have the snippet start with some form of punctuation you don’t normally type — If you prefix a snippet with common punctuation or common letters, you may inadvertently trigger the snippet when you don’t want to. Use double punctuation prefixes for extra clarity. I use the forward slash key myself, as I never use forward slash in my working day. Each person’s preferences will vary here.
  • Keep your snippet to no more than 4 or 5 letters — In theory, if you’re saving hundreds of keystrokes by using a 10-keystroke snippet, you’re still saving time. But longer snippets are harder to remember and to commit to muscle memory. I try hard to keep my snippets to no more than 4 keystrokes to ensure speed and muscle memory.
  • Use short-form (or eliminate vowels to an extent) — Again, by creating a snippet with an entire word in it, you could inadvertently trigger than snippet when you don’t want to. But if you eliminate some vowels in the word and just work with consonants, it’s less likely you’ll type the word without vowels and less likely you’ll trigger the snippet at the wrong time.

You’ll also note on the bottom of the new snippet window there are a few tips for additional snippet customization. Snippets can contain placeholders for instantly inserting the time, date, or clipboard. This is extra handy for quickly renaming files if you handle many files with date conventions.

Once created, open TextEdit and give your text snippet a shot. As soon as you finish typing that snippet, your text should instantly expand where the snippet was typed each and every time. When it works, you’ll know it — it feels like magic.

Back in the Alfred window, you can change some text snippet features, specifically the sound Alfred makes when it expands a text snippet. Click Auto Expansion Options in the top right corner and navigate to Sounds to change the sound. Mine is set to Pop as it reminded me a lot of the old TextExpander sound, but there are many good options to choose from.

Make Sure You Use Your Alfred 4 Text Snippets

As I said above, text snippets are best used for replacing consistent keystroke strings you use multiple times a day. It’s also important you commit to using snippets once you have them created — the faster you commit them to muscle memory, the more often you’ll use the snippets, and the more time you’ll save in the long run.

Text snippets work even better when you use them alongside Shortcuts or Automator workflows as well. We recently showcased a workflow for using Automator, Alfred, and Hazel for renaming PDF documents. Check it out to discover some text expansion and automation power.

Alfred 4 is one of the best productivity apps for your Mac. If you haven’t already given it a try, check out our first look to understand more about the app’s ultimate power.