HackMake

Clippings in BBEdit

I’ve been learning new things about BBEdit ever since I started using it but this article pointed out something called Clippings and it is magical. I love TextExpander just as much as BBEdit but it doesn’t work well with text selections.

Here’s a great use-case for Clippings: I’m writing in Markdown (as always) and go back to something that I want to add a link to. In apps like Byword (which I also love) you can easily select the text and hit ⌘ + K. This will wrap the selected text in standard Markdown link syntax and put your cursor right where you need it to be. I wanted to do this just as easily in BBEdit. Sure, BBEdit supports scripting but I want something as easy to create and manage as TextExpander snippets and AppleScript is clunky. With Clippings, you use commands like #SELECTION#, #INSERTION#, #CLIPBOARD#, and whatever snippet text or code you want to build your clippings. The simple one I needed for wrapping text as a Markdown link is:

[#SELECTION#](#INSERTION#)   

My selected text will become the link title and the insertion point will be where I paste in my link. You could also use #CLIPBOARD# in place of #INSERTION# if you regularly copy the link you’re adding first.

To create a clipping, type out your clipping, select it, right-click, and “Save Selection As Clipping…”. Add it to a set and it’s ready to use by choosing it in the Clipping (the big C) in your menu bar. To add a keyboard shortcut to your clipping go Window > Palettes > Clippings, to see a list of your clippings. Select the one you want, and click “Set Key”. Your clippings will live in ~/Library/Application Support/BBEdit/Clippings/[setname] and you can simply add more clippings to this set by saving a new file in that folder.

I’m curious to hear your ideas for Clippings; let me know on Twitter. And if you’d like the clippings I’ve made and use for writing in Markdown, you can download them here.