TextMate to BBEdit switcher’s guide: Bundles and scripts

The power of TextMate, and the reason many people continue to use it today, are the bundles.

BBEdit 10 supports ‘packages’, although this feature is very new and as far as I know, virtually no one is using it.

That said the feature itself is simply a replication of TM’s bundles concept, but the actual features themselves are available already.

Main Points:

Clippings in BBEdit are Snippets in TM.

Syntaxes are handled by Codeless Language Modules. The biggest different here is that BBEdit syntaxes are not “language aware”. The main point of CLMs are to do syntax highlighting and delimit folds, along with setting the clipping set. There are no “tab triggers” related to the syntax of the current language. You can do a LOT with Clippings to emulate this feature, though, but it’s not as pretty as tab triggers (IMHO).

Commands are a combination of Text Filters and Scripts. The manual covers these in great detail, but the short story is filters accept the selection or document on STDIN, and whatever the script returns replaces the selection or document on STDOUT; scripts simply run a command and the output goes to the special script output window.

There is another big takeaway here, which is BBEdit is incredibly scriptable in AppleScript. The only way to interact with BBEdit-the-application is AppleScript. So, things like “select the word at the insertion point” are only possible via AppleScript, whereas in TextMate you may have alternate methods via bundle scripting. (At least, as I recall, anyway, I haven’t done serious bundle devel on TM in some time)

You can have Clippings call AppleScripts which themselves call shell scripts; and you can use AppleScript to drive just about anything on your Mac. AppleScripts obtuseness and awkward syntax (for many programmers anyway) makes it somewhat unpleasant to work with, but there’s an immense amount of power.

Lastly, be sure to check out the sections on the manual about using AppleScript to override menu items. I mentioned this earlier and it’s another somewhat hidden gem in BBEdit.


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s