The question has two parts, one of which I already have the answer for.
- How to auto-remove trailing whitespace from the entire file being edited? -> Answer: use the AnyEdit plugin, which can be set to do that on any save to the file.
- How to auto-remove trailing whitespace only from the lines I changed? -> This I don't know and would appreciate any help.