A few weeks ago, LaunchBar 5.5 update brought — among other interesting things — a new feature called Snippets, which actually is a complete overhaul of its previous “Text Clippings” feature. As the devs advertised Snippets as “a serious text expansion tool”, I was curious to see how this compares to one of the references in text substitution on the Mac: TextExpander.
So, for one week, I did a little experiment: I closed TextExpander and acted as if it was never installed on my Mac, and chose to use only LaunchBar instead. Read on to find out how all of this turned out.
Before you read on, I must warn you: if you use TextExpander to perform scripts and so on, the Snippets feature of LaunchBar can’t do that. But if you’re just using TextExpander to, well, expand text as I do, or occasionally add dates/times and grab something from the clipboard, then LaunchBar Snippets and TextExpander play in the same field.
Setting up LaunchBar for text expansion
In this little tutorial, I’ll guide you through how to create snippets and how to use them. Also, one of the welcome features of TextExpander is the ability to synchronize your snippets between machines using Dropbox. LaunchBar does not offer this out of the box, but it’s not that difficult to achieve it. I’ll show you first how to do this, so your newly created snippets will instantly be available everywhere (except on iOS of course, we’re talking about LaunchBar here).
To synchronize all of your LaunchBar snippets between machines, follow these simple steps:
- First, quit LaunchBar, just to make sure you don’t mess up with anything in progress.
- LaunchBar snippets are stored in ~/Library/Application Support/LaunchBar/Snippets. Copy this folder to Dropbox. I chose put this Snippets folder within a newly created folder /Dropbox/Applications/LaunchBar.
- Create a symbolic link for this folder you’ve just put in Dropbox. You can do this the simple GUI way by downloading SymbolicLinker, which will give you a contextual menu within the Finder to make symbolic links.
- You now have a ‘Snippets symlink’ folder. Move it back to /Users/[yourusername]/Library/Application Support/LaunchBar/Snippets
- Delete the old Snippets folder in ~/Library/Application Support/LaunchBar.
- Rename ‘Snippets symlink’ to simply ‘Snippets’.
- Restart LaunchBar.
That’s all! Now every snippet you create on one machine will be available on other Mac too.
Creating new snippets
There are many ways of creating new Snippets in LaunchBar.
Create a new snippet from scratch with the ‘Add Snippet’ action
If you want to create a new snippet from scratch, just press your general keyboard shortcut to activate LaunchBar (Cmd-Space in my case) then:
- Start typing Add Snippet (remember: never type spaces in LaunchBar commands, these will activate Quick Look — typing “addsnip” without the quotes should be enough to highlight the corresponding action). Once the Add Snippet action is selected, press Enter.
- In the field right next to “Add Snippet”: type the text you want to store as a snippet.
- Press Enter: You’ve just created a new snippet in LaunchBar!
Overtime, due to the learning algorithm of LaunchBar, you will have to type less and less. After a few uses, I just need to type ‘as’ and ‘Add Snippet’ is the first match in the list.
Instant Send then ‘Add Snippet’
If you’ve already typed something in, say, your favorite text editor, or if there is some text within a document or a web page that you want to store as a snippet, then perform the following steps:
- Select the text.
- Use the Instant Send of LaunchBar (you can simply use your keyboard shortcut to activate LaunchBar and hold the last key a bit longer to do this; as I use case Cmd-Space for LaunchBar, I just press Cmd and hold Space for one second to achieve this).
- Press Tab.
- Start typing ‘Add Snippet’ (without the quotes and without space) to make LaunchBar match this action name. Once the ‘Add Snippet’ action is highlighted, press Enter.
Create a snippet from items stored in the Clipboard history
If you have some text stored in your Clipboard history that you’d like to store as a snippet:
- Make LaunchBar show your Clipboard History (see the “Show clipboard history:” field in the “Keyboard Shortcuts” list from the Clipboard tab in LaunchBar preferences to define your own shortcut for this)
- Select (with Up or Down arrow) the desired text
- Press Tab and type “Add Snippet” (without quotes and without space, as usual)
- Once you’ve pressed Enter, a new snippet is created based on this item from your clipboard history
Playing with placeholders
As you might expect from “a serious text expansion tool”, you can use some placeholders in your snippets. The most common ones are:
For dates, you can specify a format by using different “YYYY MM dd” combinations or simply use the shorthands <date full>, <date long>, <date medium> and <date short>. The shorthands will reflect what you’ve set in the Formats tab of the “Language & Text” category in OS X System Preferences. Same thing with the various <time> placeholders.
If you don’t want to try and guess which combination of letters to use to craft your perfect date/time snippet, I strongly recommend you head over to this online help document. That’s the only place where I found useful info on how to use the new Snippets feature, documentation being inexistent within the app itself (good luck trying with the LaunchBar Help file, or I missed something there).
Because LaunchBar keeps track of your clipboard history, you can access every item using ‘numbered’ clipboard placeholder. For instance:
- while <clipboard> refers to the most recent copied text,
- <clipboard 2> refers to what’s been copied just before,
- <clipboard 3> to what’s been copied before <clipboard 2>,
and so on.
Finally, something TextExpander users will be familiar with is the “|” (pipe symbol) that moves the text insertion point to where the placeholder was.
Browsing through, acting on, and using snippets
A new Snippets category has been added to the LaunchBar index. Browse through it to show the complete list of your snippets. There is even a new “Snippets:” keyboard shortcut in the Shortcuts tab of LaunchBar Preferences that, when activated, will directly open your snippets list in LaunchBar. By the way, when browsing this list, pressing Cmd-N is another way of creating a new snippet.
While a snippet is selected, you can:
- press Enter to insert its content in the frontmost application
- rename it by pressing Shift-Cmd-R
- assign it an abbreviation by pressing Shift-Cmd-A
If you assign a snippet an abbreviation, you then have something really similar to TextExpander. The only difference is that you have to invoke LaunchBar first (Cmd-Space for me) instead of adding a trigger as you would do in TextExpander.
The beauty of LaunchBar and its powerful smart search is that you don’t have to remember an abbreviation to use a snippet. Just start typing something the snippet you’re looking for contains and LaunchBar will easily find it. You don’t even need to narrow your search to the Snippet category first. Snippets are indexed just like anything else. This reminds me of the “Search Snippets” accessible from the TextExpander icon in the menu bar.
What LaunchBar Snippets really are
Surprisingly, LaunchBar Snippets are just text files stored in the Finder. It means you can easily:
- show a snippet file in the Finder with Cmd-Enter
- edit each snippet individually with any text editor (or directly open it in your default text editor with Shift-Enter)
- preview a snippet with Quicklook within LaunchBar (just press Space or Cmd-Y)
- move them to Trash (Cmd-Backspace)
- navigate into them line by line, word by word (with the Right, Up and Down arrow) just as with every text file accessed in LaunchBar
You might wonder why having snippets stored as text files might be handy. If you just use short (no more than a few words long) snippets, there’s a chance you won’t need this. But imagine now dealing with long, multiple lines snippets. Since LaunchBar doesn’t offer a multi-line editing window as TextExpander do, bringing up your own text editor for the task is a really nice addition.
So, what to choose?
If you have some basic text expansion needs (i.e. you don’t use the geekiest features of TextExpander like shellscript/AppleScript or the fill-in snippets), then the Snippets feature of LaunchBar might be all you need.
Creating new snippets is easy, inserting one too, and you can, with the little trick I explained at the beginning of this article, have them synchronized between your Mac. As LaunchBar snippets are just plain-text files, it’s easy to deal with them. Also, not having to remember any abbreviation to use a snippet is neat. Though you can already do that with the menubar Search feature of TextExpander. In conclusion, if you don’t already own TextExpander but already have LaunchBar at hand, it might be worth it considering not spending the extra cash on a text expansion tool, especially when your launcher can already do most of it.
I am — maybe a bit overly — attached to the TextExpander snippet workflow, though. TextExpander monitors all keystrokes and instantly expands characters sequences — provided you correctly remember your defined abbreviations. With LaunchBar, you have to activate the app first to use its snippets. Getting used to this LaunchBar way takes a bit of time if you’re a long TextExpander user.
But it was a fun thing to experiment with and remember, Snippets are just new to LaunchBar, who knows what the devs might have in store for the next iterations.
Do you see a use case for the Snippets feature of LaunchBar? What’s your favorite text expansion utility? Please tell us in the comments.