NOTICE: This method has a major drawback that is corrected in a the new post: Proper Trimming on Save with TextMate

One thing Text Mate doesn't do by default, and lacks an easy preference setting for, is trim trailing spaces when saving. Luckily, there is an easy way to implement this feature.

  1. Select Bundles->Bundles Editor->Show Bundle Editor
  2. Find Text->Remove Trailing Spaces in Document
  3. Make it look as follows:

Text Mate Bundle Editor

Now, whenever you save your document the trailing spaces will be eliminated.

A slightly faster way is to replace the perl script with:

  sed -e "s/ {1,}$//"

[Update 1] I just noticed that every blue moon multiple copies of the file will get appended instead of replacing. Not sure exactly the cause, but I can host C-s down repeatedly and not force the problem to occur, so YMMV.