+4

trim trailing whitespace as sublime command

David Baumgold 6 years ago 0
I wanted to be able to trim trailing whitespace on my file by opening the Command Palette and just typing it in. I was about to write my own plugin, when I noticed that the "trim_trailing_white_space_on_save" option was implemented in the Default plugin -- so I just modified that! I've put together a patch file which you can download at http://www.davidbaumgold.com/files/trim-trailing-whitespace.patch (or view at http://paste.pocoo.org/show/580870/).

The patch adds a text command to run "Trim Trailing Whitespace" from the command palette, and it operates either on the whole file, or on just the part that you have selected.