+30

Only cleanup whitespace for modified lines

codex 13 years ago updated by Will Schmid 11 years ago 4
In commercial software development, it is desirable to minimize the number of unrelated changes to a file.  For this reason, it would be nice if ST2 only stripped trailing whitespace (or performed any kind of whitespace cleanup) on regions of the file that have been modified, ideally as measured against the copy as stored in one's revision control system.  Eclipse does this.
+2
I think strip trailing whitespace could use a couple settings:

Options: Strip / Do not strip trialing whitespace

Suboptions for "on" setting:
1. Only for modified lines
2. Don't strip lines that are 100% whitespace
2.a Fix such lines if they do not match the indentation of the preceding line
+2
IntelliJ does this too, and it's very useful in a team environment. It has three simple, well chosen settings for "Strip trailing spaces on save":
  1. Modified Lines
  2. All
  3. None

I'd like to add my support for this feature. Only removing trailing whitespace for modified lines would make it much easier to collaborate with team members that don't strip trailing whitespace. (Otherwise diffs are full of annoying whitespace changes.)

-3

Yes!


trim_trailing_white_space_on_save