This plugin is an alternative to the default option trim_trailing_white_space_on_save which removes any trailing whitespace when the user saves a file.
Instead of removing whitespace everywhere, this plugin only removes whitespace where the whole line is entirely consistant of whitespace.
You can enable this through the preferences (or syntax-specific) like so:
{
"strip_whitespace_lines_on_save": true,
}- Install the Sublime Text Package Control plugin if you haven't already.
- Open up the command palette (Ctrl+Shift+P) and enter
Package Control: Install Package - Search for
Strip Whitespace Linesand hit Enter to install. - Follow the instructions that appears on the screen.
- Click the
Preferences > Browse Packagesmenu. - Open up a terminal and execute the following:
git clone https://github.com/p3lim/sublime-strip-whitespace-lines Strip\ Whitespace\ Lines
- Restart Sublime Text.