Whitespace TextMate 2 bundle

One of my favorite features of TextMate 2 (that I know of) is scope injections. It makes it possible (amongst other things) to inject a grammar into an existing scope. I’ve taken advantage of this to create a Whitespace bundle that will hightlight your whitespace hiccups no matter what files you are editing.

So far it hightlights mixed tabs/spaces and trailing whitespace. It uses the scopes invalid.illegal.whitespace.mixed and invalid.illegal.whitespace.trailing so your theme needs to have a background color setting for invalid before you see the highlights. Note that this may miss some whitespace if it has already been consumed by another rule of the parent grammar.

You can get the bundle here

To install it simply download it and place it in the ~/Library/Application\ Support/Avian/Bundles/ folder.

When you have the bundle installed you can always disable either of the grammars if you only want it to highlight some of your hiccups.