Expanding Snippets Based on the Before and After

Maia Olson Blog, TextExpander, TextExpander Tips

TextExpander

If you’ve used TextExpander, then you may have experienced a snippet not expanding when you expected it to. Say, right after a parenthesis. Or, you may have seen snippets expand in places you hadn’t anticipated. Say, in the middle of a word. This is due to the character you typed just before, or just after, the abbreviation.

TextExpander_AbbreviationBefore

What comes before: “Expand when:”

By default, all snippet groups are set to expand after a blank space, or white space. Meaning, press spacebar, type your abbreviation, your snippet expands. Handy if you have snippet abbreviations which are part of a word.

Say you have “vark” as an abbreviation. Seems unlikely to get typed by accident, so it fulfills that rule of a good abbreviation.

If you type the word “Aardvark,” by the time you finish typing you’ve typed your abbreviation. If your snippets expand directly next to any character what you end up with is “Aardandsomesnippet”.

We suggest you leave most of your groups set to expand after a white space, and create a separate group for snippets which expand directly next to other characters.

Here are a couple snippets perfect for a group which expands when typed next to any character:
– -year-old
– @companyemail.com
– anything you frequently type after a parenthesis () [] {}

HTML and code snippet groups are also best set to expand next to any character. For this particular case, consider having these groups only expand in a certain app. This way, when writing an email you don’t have < p > < / p > tags suddenly appearing. You can set this in Group Settings > Expand in:.

Adjust a group’s Expand when: setting:
1. Click on a snippet group, the Group Settings will appear to the right.
2. In the Expand when: menu select Any character precedes abbreviation if you want snippets to expand next to any possible character, including letters. Select All but letters and numbers precedes abbreviation if you want snippets to expand when directly next to punctuation or white space.

Group Settings


TextExpander_AbbreviationAfter


What comes after: Delimiters

Control whether a typed abbreviation will expand based on what character you type right after it. The key you choose to control whether or not expansion happens is the delimiter.

In the case of a snippet like “vark,” you can type out “Aardvark” knowing your snippet won’t expand as long as you don’t press your chosen delimiter key, such as Enter, Tab, or a punctuation key.

Choose one or more keys to act as delimiters in Preferences > Expansion > Set Delimiter. There are several to choose from, type or drag in your preferred characters.

This setting is independent of the Expand when: setting, and unlike it, it is a global, all or nothing, setting.

Delimiter window

Questions about TextExpander features and settings? Let us know.