Sublime Text 2: Remove trailing whitespaces on save

January 11, 2013

Reading time ~1 minute

I ran into one of the most wonderful features in Sublime Text 2; automatic trailing space removal on save! It is really easy to configure. Just open your settings (cmd + , on Mac OS X) and add "trim_trailing_white_space_on_save": true:

{
    "color_scheme": "Packages/Theme - Phoenix/Color Scheme/Tomorrow-Night.tmTheme",
    "font_size": 18.0,
    "ignored_packages":
    [
        "Vintage",
        "SublimeLove"
    ],
    "rulers":
    [
        80
    ],
    "tab_size": 4,
    "theme": "Soda Dark.sublime-theme",
    "translate_tabs_to_spaces": true,
    "trim_trailing_white_space_on_save": true
}