TextMate Bundle Quick Tutorial

This is a quick tutorial on how to create a new TextMate command using the Bundle Editor. First, open the Bundle Editor: Bundles -> Bundle Editor -> Edit Commands

Next, click the little plus sign (bottom left) and select New Command.

If you wish to give your command a particular scope just drag it into your desired language, i.e. PHP.

Give your new command a name (optional but seems crazy not to), tab over to the editor window labeled Command(s): and enter the code for your new command. The one I am going to share today auto-escapes quotes for quick and easy copy/pasting of strings, namely for use with HTML elements. The snippet also shows the code for unescaping strings but for all practical purposes you would only want one or the other for any given command. It is also important to bind this command to a hot key which can be done by selecting Key Equivalent (next to Activation:) and pressing the hot key combination you would like to bind to this command.

The ruby code above could easily be replaced with anything that interacts with the shell or other functions available to TextMate. Below is what your command to escape strings should look like in the Bundle Editor window.
TextMate Bundle Editor

Bundles are a really a powerful feature and should be used heavily! I highly recommend checking out the GetBundles bundle as it provides hooks into GitHub and offers hundreds of downloadable bundles.

Some good resources for TextMate: