Pimp My TextMate

How to TextMate like a real baller.

Xzibit

Yo dawg, I herd you like coding…

TextMate is the editor of choice for many Mac developers, from ruby to javascript and beyond.

For our web projects, it’s a natural choice because of how easy it is to switch contexts.

One of TextMate’s largest strengths, however, is how extensible it is.

This guide rounds up some of the best plugins, bundles, and tricks out there so you can pimp your TextMate and code like a real baller.

Before Starting

TextMate integrates really tightly with your environment and can run pretty much any unix executable you throw at it.

Lots of the plugins and bundles mentioned later will require you to install some new programs.

To do this quickly and painlessly, make sure you have the following installed:

Also, make sure you have /usr/local/bin in your TextMate PATH:

Bundles

TextMate allows developers to extend the editor’s understanding of its content through Bundles. To install a bundle, you only need to download it and double-click it. TextMate handles the rest.

JSHint

JSHint

This awesome JSHint TextMate Bundle includes the JavaScript syntax tool, jshint, and can run it for you every time you save a file.

This is not only super helpful in keeping your scripts error-free, but is invaluable in keeping your sanity when it comes time to minify your scripts.

Dependencies:

Installation:

Usage:

Sparkup

Sparkup

Sparkup is an awesome syntax for writing HTML hella fast using CSS selectors.

Dependencies:

Installation:

Usage:

AlignText

Aligntext

AlignText is an awesome bundle that provides one command for aligning your text vertically.

Dependencies:

Installation:

Usage:

  ( function( )
  {
    $.ajax(
      {
        url: 'http://gcao.posterous.com/aligntexttmbundle',
        dataType  : 'text',
        type : 'GET',
        mySuperLongSuccessHandler : function( response )
        {
          alert( "Dope!" );
        }
      } );
  } )( jQuery );
  

… and I select the middle section and align on colon (:), I get:

  ( function( )
  {
    $.ajax(
      {
        url                       : 'http://gcao.posterous.com/aligntexttmbundle',
        dataType                  : 'text',
        type                      : 'GET',
        mySuperLongSuccessHandler : function( response )
        {
          alert( "Dope!" );
        }
      } );
  } )( jQuery );
  

… which is a LOT easier to read!

Other Bundles

There are plenty of other bundles out there that don’t require much explanation. Here are some of the best:

Plugins

Much like Bundles, you can install TextMate Plugins simply by double-clicking them. Plugins alter the editor itself and can add additional windows, commands, and the like.

AckMate

AckMate

In really large projects, TextMate’s Find in Project becomes very slow, and slow search is not baller.

Enter AckMate, a super-slick plugin to provide an interface to ack, the blazing fast command-line search tool.

Dependencies:

Installation:

Usage:

ProjectPlus

Dependencies:

None!

Installation:

Usage:

Tips & Tricks

TextMate is endlessly extensible. You can write your own commands in any language you’d like (bash, ruby, python, javascript, even PHP). You can also write your own snippets for any context.

Here are some other tips and tricks for getting the most out of your editor.

Color Picker in CSS context

Colorpicker

When you’re writing CSS and you want your colors to be exact, you can’t beat a color picker.

Hit ⇧⌘C (Shift-Command-C) to bring it up, then use the magnifying glass to pick up colors right out of your comps!

A little-known command for Find in Document, better than ⌘F, is ⌤S (Control-S). Hit that combo to pop open a small text field at the bottom of your window. Begin typing there and your entry will highlight in the document. Hit the combo again to move to the next occurrence of your entry.

Spell-Check

Hit ⌘: (Command-:) to cycle through possibly misspelled words in your document. Then, hit ⌘⌥: (Command-Shift-:) to bring up a dictionary control.

Open Terminal to your project directory

Highlight a file in your project drawer and hit ⌤⌥O (Control-Shift-O) to open a new Terminal window, located where your selected file lives.