So yes, it’s true. I’ve been using Textmate lately. I’m still using Debian and the trusty Thinkpad (and eyeballing the sexy X300), but also have picked up a MacBook Air, and am dabbling in the world of Mate.
One thing that has bothered me about my typing in Mate (other than the lack of using modes) is that something I’m doing is leaving trailing whitespace. This, of course, is a problem. Eventually I’ll figure out what muscle memory reflex is causing this, but there are a few things I’ve found along the way to help identify these vile and unnecessary bytes in my documents.
Add Syntax Highlighting for Trailing Whitespaces
First we must at a rule to match trailing spaces in our language of choice.
{Q: Can we do this for all languages?}

Secondly, assign a color to this property in your theme of choice.

Keyboard Shortcut to Remove all Trailing Whitespaces
TextMate comes with a command to remove all trailing spaces from a document. Why not assign a keyboard shortcut to it?
{Q: I’d love to do this on-save of all documents.}

From: http://wiki.macromates.com/Suggestions/ProjectManagement
Well, how about the ability to run shell scripts on file open/save, then?
There’ll be some form for callback when I add real scripting support. For now, if you need actions executed on file save, I’d recommend looking into Stakeout (http://pragmaticautomation.com/cgi-bin/pragauto.cgi/Monitor/StakingOutFileChanges.rdoc)
No (yet) quite a clean as one would hope.
@George: Ouch. Yes that would be nice : ) Not sure if I want to dive down the StakeOut route.
Ooh nice idea of the invalid.trailing-whitespace scope.
I use a script from Tim Burks that formats my code and removes trailing whitespace. I’ve bound it to Command-B:
http://blog.neontology.com/articles/2006/05/10/beautiful-ruby-in-textmate
Related to StakeOut, I recommend checking out incron for Linux. As the name suggests, it’s inspired by the cron system (“execute foo when bar”). Instead of using times, it uses inotify events about filesystem changes. I’ve been meaning to put something together so whenever I update a source code file (whether it’s via an editor or a repo update), the index is updated automatically.
You can do this, but it still means changing each grammar – but it’s done using an include, so any changes you make to the core grammar it take affect across the board.
I’ve written it up here:
http://remysharp.com/2008/03/30/trailing-white-space-in-textmate/
Thanks so much!
Remy: That’s awesome! How does having a common grammar allow you to apply it at the time of save?
I’ve debated the onsave issue a bit. On one hand, it’s fantastic if you’re working with a clean file, but I want general whitespace “fixes/removal” in their own commits, not mucking up the patches of important work. I’m afraid that this would encourage bad habits among people.
Another alternative I’ve considered is having a post-commit hook in {insert-revision-control-of-choice} remote trailing whitespace. This would be handy, but I don’t really like my revision control playing with the contents of my file, even though there’s a history of it which changesets in CVS. It just gives me the willies.