Getting started with text substitutions

Text substitutions are a relatively new feature that were introduced with Snow Leopard. They allow you to set up certain phrases to get automatically replaced with something else as you type. If you go to the Language & Text section of System Preferences and click on the text tab, you will see a list of substitutions already set up, for example (c) to © and 1/2 to ½.

Oddly, it seems that the only application that text substitutions are enabled in by default is TextEdit, and you need to enable them separately in every other application. To do this, open up the application in question and right-click (Control-click) on any area where you can type. In the menu that appears, go to Substitutions and choose “Show Substitutions.” This will bring up a dialog box where you enable Text Replacement and various other substitution features. If the application doesn’t support text substitutions, you won’t see this menu.

Text Substitutions

Doing this separately for every application is a bit annoying, especially if you want to enable text substitutions everywhere. Fortunately it is possible to enable text substitutions globally using a Terminal command. Just open up Terminal (located in Applications/Utilities), copy and paste in the following line, then press return.

defaults write -g WebAutomaticTextReplacementEnabled -bool true

This will turn on text substitutions in every application that supports them, but you can still go into individual applications and turn them off on a per application basis if you want.

Now you have text substitutions enabled, you can add new ones in the Language & Text section of System Preferences by clicking the plus (+) button at the bottom of the list. Here are some ideas for substitutions to set up.

  1. Expand internet and messaging slang abbreviations. For example you could set brb to “be right back” and ty to “thank you”
  2. Use something like lipsum to insert a few paragraphs of Lorem Ipsum placeholder text so you don’t have to Google for it each time.
  3. Use something like msig to automatically insert your signature at the end of mail messages or forum posts.
  4. Automatically enter commonly used commands and code snippets that are too long to remember or too tedious to type. For example you could set rruby to enter the first line of a ruby script #!/usr/bin/env ruby.
  5. Abbreviate email addresses that you find yourself regularly typing, for example set matt@ to give
  6. Create email templates to automatically write out “canned responses.” For example I have ssorry expand to a detailed email reply saying that I can’t help with a computer problem and explaining some places to go to find out.

When you come to enter some of the longer substitutions such as email signatures or whole email messages, you will run into the problem of how to enter a line break, as just pressing Return doesn’t work. There are a couple of ways to get around this. Firstly, you can simply use Option-Return instead. Option-Tab is also useful for inserting a Tab character. This is the quickest and easiest way, especially for short replacements like email signatures that only have a couple of lines. If you are creating a replacement that is more than a few lines, you may find it easier to write it in something like TextEdit and then copy and paste it into the list in System Preferences. All the line breaks will be preserved.

One final use for text substitutions is to exclude words from spelling auto-correction. Sometimes you will have a word that you don’t want to auto-correct, but you don’t want to permanently add it to the dictionary using “Learn word” because it isn’t an actual word. To get around this, just add it as a text substitution and make the text replacement the same as the original word. Now the spelling auto-correction will never happen.

blog comments powered by Disqus