Introducing LaunchBar Snippets

LaunchBar 5.5 adds a new feature called “Snippets”. It’s a fast and easy way to work with often–used pieces of small text.

Now, to many power users on the Mac, snippets aren’t exactly new. They aren’t even really new to LaunchBar. “Text Clippings” could be used for much of what the new snippets do now, but that little face lift we gave them really goes a long way to making LaunchBar a serious text expansion tool.

What makes LaunchBar stand out from these other text expansion tools out there is a seamless integration with its other features:

  • Add new snippets using Instant Send or from the Clipboard History
  • Find snippets using LaunchBar’s smart abbreviation search
  • LaunchBar learns your habits
  • Quickly insert snippets using Instant Open
  • Use the Clipboard History to fill placeholders in your snippets
  • Peek into existing snippets using QuickLook

Adding Snippets

To add a new snippet, activate LaunchBar by pressing ⌘Space, select the new “Add Snippet” action, then hit Space again (or ↩). Now enter the text you often use:

When you hit ↩, LaunchBar creates a new snippet and selects it. To paste it to the frontmost application, hit ↩.

You can also use it like every other item in LaunchBar:

  • ⌘C to copy the snippet’s contents
  • Hit Space to view it in QuickLook
  • ⌘⇧R to rename
  • ⌥⌘A to assign an abbreviation
  • ⇧↩ to edit in your default text editor
  • ⇥ to select it for Instant Send
  • ⌘⌫ for Move to Trash
  • ⌘↩ for Show in Finder

Wait, what were those last two things? Yep, snippets are actually plain text files (.txt) in a directory on your disk. This means you can treat a snippet like you would any other file in LaunchBar. It also means that you can put any plain text file inside this directory and it gets picked up by LaunchBar as a snippet.

Because “Add Snippet” is an action that expects some text input (just like e.g. the Wikipedia search template), you can not only give it some text after hitting ↩ or Space, but also by using Instant Send:

If you want to permanently save some text from your Clipboard History as a snippet, simply select that item there, hit ⇥ and send it to the “Add Snippet” action.

Finding Snippets

Unlike with other text expansion tools, there’s no need to remember some cryptic combination of letters as a shortcut for snippets. Thanks to LaunchBar’s smart abbreviation search, snippets are found by simply typing a few letters that appear in its name. You know, just like everything else in LaunchBar.

There’s even a new preference for activating LaunchBar with a shortcut that lists all your snippets to browse. It’s disabled by default, so head over to the “Shortcuts” tab in LaunchBar’s preferences to enable it.

You can also browse all snippets by selecting the “Snippets” indexing rule in LaunchBar and navigating into it by hitting →.

Placeholders in Snippets

By adding placeholders, you can fill in pieces in snippets that vary. When you use the snippet, the placeholders are replaced by certain values. For example:

Today is <date MMM dd> and it’s <time short>.

These two placeholders (those parts with the angle brackets) insert the current date and time, respectively. You can specify the format in which a date and time is inserted by adding format specifiers (the MMM dd part) or by using the shorthands “short”, “medium”, “long” or “full”.

The last copied text on the clipboard is <clipboard> and the two things before that are <clipboard 2> and <clipboard 3>.

These placeholders insert whatever text there is on the clipboard. Adding a number to the placeholder takes text from the clipboard history.

Hello, <first name>, nice to <|meet> you!

Upon using this snippet, the “first name” placeholder is replaced with what you’d expect (assuming “My Card” in OS X’s Contacts app is set correctly). “last name” and “full name” are also available.

The placeholder with the pipe symbol (“|”) moves the text insertion point to where the placeholder was and in this case selects “meet” so you can replace it by typing. The text after the pipe symbol is optional.

(Pro tip: if you send some text to a snippet that contains the “<|>” placeholder via Instant Send, that text is automatically inserted.)

Snippets in LaunchBar are really easy to add and to use. Inserting a placeholder here and there makes them very versatile, but it’s the combination with LaunchBar’s other features that makes them extremely powerful. We hope you like them!