Sublime Text 2: Trim trailing white space on demand

Beware: using this plugin makes Sublime Text significantly slower

I use TrailingSpaces plugin for this.

Highlight trailing spaces and delete them in a flash.

ST2 provides a way to automatically delete trailing spaces upon file save. Depending on your settings, it may be more handy to just highlight them and/or delete them by hand. This plugin provides just that!

Usage: click "Edit / Trailing Spaces / Delete".

To add a key binding, open "Preferences / Key Bindings - User" and add:

{ "keys": ["ctrl+alt+t"], "command": "delete_trailing_spaces" }

I use these steps for a quick on-demand solution within Sublime Text:

  1. Find > Replace...
  2. Find What: [ \t]+\n
  3. Replace With: \n
  4. Replace All

You could also do this for a large set of files via

  1. Find > Find in Files...
  2. Find: [ \t]+\n
  3. Where:
  4. Replace: \n
  5. Replace