Strip trailing whitespace option


#1

I would like to see an option to strip trailing whitespace [on save].


#2

Already there. Check the Whitespace package:


#3

And enabled! It just didn’t work in my trivial test. Turns out it only fails to strip the trailing whitespace on the current line if the cursor is at the end. All the other lines get stripped.

Test:   <save>

results:

Test:   <cursor>

expected:

Test:<cursor>

I don’t know if that’s worth submitting a ticket about or not. I always thought it was a little spooky. I’ll wait and see if I notice it while not doing ridiculous tests.

Thanks!


#4

My mistake - it fails to strip the current line no matter where the cursor is. Filing.


#5

That behavior is controlled by the “Ignore Whitespace On Current Line” setting which you can see in my screenshot above. Just turn it off if that’s not your desired behavior.


#6

I moved a post to a new topic: Ensure Single Trailing Newline not working?