Validate on Save for TextMate

I’ve been using TextMate almost exclusively for years for writing all kinds of code, shell scripts, PHP, Ruby, JavaScript, HTML, CSS… it’s one of those programs that excels at the thing that it does, and the thing that it does is get out of the way and let you do your thing.

I never seemed to outgrow it. Nearly everytime I’ve wanted it to do something, either someone else put something together or I’ve been able to extend it by writing my own commands or modifying an existing one.

One of the things I’ve done is bind the shortcut to save (cmd+s) to also validate my PHP or Ruby. Total time saver. If you’re a web developer you’re probably well aware of the save/switch/refresh/crash/switch/fix/save dance that one does between code editor and browser.

Recently, I decided to package it all up and throw in a couple other validators into it, and thusly the Validate on Save TextMate Bundle was born. This bundle will bind the save shortcut for you, and validate your PHP, Ruby, JavaScript, and CSS.

If you’re running Compass (a framework to Sass‘s CSS abstraction)1 this tool will try to compile your Sass files and return any errors it outputs.

If you install with Git using the instructions in the README, you’ll have instant access to updates, just click the Bundles > Validate On Save > Update Bundle menu command.

There are a few other configuration options in there, like using Growl for notification or jumping directly to the line the validator found errors, but in both cases, the results were a bit iffy so you’ll have to enabled those (by following the helpful instructions).

I showed an early version of this to my friend Jim Myhrberg, who refused to let me get away with distributing my messy code, so he did a ton of reorganization and cleanup that ultimately make this even easier for us to perhaps someday add more validators.

  1. If you have no idea what I’m talking about but write CSS, do yourself a favor and check it out. Highly recommended.