Setting Up Text Auto-Expansion for Snippets

With Alfred's Snippet auto-expansion, you can expand your snippets automatically in any app by typing the snippet's keyword, without popping up Alfred's Snippets window!

Snippet auto-expansion is disabled by default. To activate it, launch Alfred's preferences to Features > Snippets and check the box for "Automatically expand snippets by keyword".

Want to learn more about Snippets generally? Pop by the Snippets Feature page first.

1. Activating expansion

Under Features > Snippets, check the box to activate the automatic expansion of keywords. The first time you do this, you'll be prompted to launch OS X's Accessibility preferences and grant the Alfred Text Service access to control your computer using accessibility features.

Using Alfred 3.3.1 or earlier? The activation process is slightly different to the one below, which reflects the latest update. Grab Alfred 3.3.2+ from the update tab, or simply follow the instructions as they're presented to you on your Mac. :)

Welcome to Alfred Expansion

Click "Let's get started!" to pop up the request to grant Accessibility permissions to Alfred Text Service on your Mac.

Alfred Text Service pop-up

Click "Open System Preferences" to proceed to the next step. Once the Accessibility preferences launch, you may need to click the lock in the bottom left and type in your user account password to make changes.

Check the box next to Alfred Text Service to complete setup.

Alfred Text Service preferences

You'll now see the box for "Automatically expand snippets by keyword" ticked in Alfred's Snippets preferences.

Time to get started with text auto-expansion by creating a few snippets!

2. Create a snippet with a keyword

Next, create a new snippet or pick a snippet with a suitable keyword. Take a look at the tips for picking great keywords below.

Creating a new snippet

Make sure the checkbox for the snippet you want to auto-expand has been ticked.

3. Type your keyword in a window to expand your snippet in place

To use the snippet, simply type the keyword you set into the app or text field you want. As if by magic, your keyword will be replaced will the full text snippet!

Snippet in action

For your security, Alfred doesn't listen for characters typed when you are in a secure text field, such as a password field, so he won't expand a text snippet in a secure field.

Tips For Better Snippet Expansion

To get the most out of the expansion feature, your keywords need to be memorable but shouldn't be triggered by mistake. Here are some ideas to help you set useful snippet keywords.

  • Use non-word keywords to avoid unexpected expansion; Don't use the keyword date to paste the date, otherwise every time you try to type it's a date!, you'll find yourself saying it's a 01/06/16! as your snippet auto-expands.
  • Start all your snippets with the same non-alphanumeric character, such as an exclamation mark, colon or semi-colon. (e.g. !office). Use collection-wide prefixes and suffixes to do this.
  • Use unusual capitalisation (Alfred will respect the capitalisation you set, e.g. officE)
  • Use double characters (e.g. ttime)

For more advanced Snippet Text Expansion setup, take a look at the options by clicking the cog in the top right of the Snippets preferences.

These options include; Apps in which snippets should not expand, the ability to turn off the sound when expanding snippets, tweaking options to slow down key events (for slower Macs, or when using non-standard software) and more.

Latest Blog Post:

Tutorial: Creating the Fastest Hotkey-Based Web Search

CacheFly Campaign Monitor

"Alfred" is a registered trademark of Running with Crayons Ltd. ©2017 Running with Crayons Ltd. All rights reserved.

Terms & Conditions, Privacy Policy, Cookies.