iOS-ify your Mac Snippet Abbreviations

For those of us who made the bulk of our snippets on the Mac, some of us use a system of prefixes to differentiate snippets from other words we type. For example,

slash / used to start web addresses
comma comma ,, used to start code snippets
semi-colon ; used to start snippets you share with the rest of your team

Whatever your prefix system, it is tricky to use these types of snippets on iOS, where punctuation keys take an extra tap to shift out of letter view into punctuation view.

In trying to solve this problem, we have considered adding a key to the letter view of the TextExpander keyboard which is programmable by the user. As in, you would have an extra key to setup as a semi-colon ; key on the letter view of the keyboard, while others could choose to make that a / slash key. 

However, this is still on the “nice to have in the future” feature list. In the meantime, here’s a script-based work-around.

Download this Abbreviation Alias script to create a new group of snippet aliases which have your choice of iOS friendly abbreviation prefix. You will end up with a new snippet group and your current snippets are not effected.

How does this work?

This script uses the nested snippet feature of TextExpander. While a single snippet cannot have two abbreviations, you can have two snippets, both with unique abbreviations, where the second nests the first so that both expand to the same content. This script makes those second snippets for you so you can have your Mac abbreviations and your iOS abbreviations. For example:

Snippet 1: Mac style

Abbreviation: /wiki

Snippet 2: iOS style

Abbreviation: zzwiki
Content: %snippet:/wiki%

Use the Script

1. Download the script and click on it to open it in the AppleScript Editor, an app that comes with your Mac. Yes, this means you are looking at actual script, but we have added directions for you to follow, all of the gray text on each line after a “–“.

There are only two places you need to change things:

  • Set the abbreviation prefix you use and want to change
  • Set the new iOS friendly prefix you want to use

Optional Third

  • Scan your snippets one group at a time instead of all at once by changing the word “true” to “false” 

2. Once you have done this, in the menubar of the AppleScript Editor window click on “Run.” If you chose to run one group at a time a popup window will appear to let you choose one of your snippet groups.

3. A dialog will appear to let you save and name the new snippet group, which appears in the dialog as a TSV file. It will even show you how many new snippets you have. Click Save and you will find a new group of snippets in TextExpander with their punctuation prefixes replaced with iOS friendly “cc” or “zz” or whatever you chose.

It doesn’t matter where the TSV file saves, once you see the new group in the TextExpander window, you can delete the TSV file.

This new group is just aliases. When you need to edit a snippet, go to the original snippet to edit its contents.