Highlight trailing whitespace

Felix Yuan 7 years ago • updated by Oktay Acikalin 7 years ago 3
In some of our older files there's a lot of trailing whitespace. I don't want to turn on trim trailing whitespace because it would nuke our files and cause a lot of merge conflicts, but I also want to avoid writing it.

Turning on drawWhiteSpace to all is kind of overwhelming. Is there a way to highlight only the trailing white space.
I've defined custom scope in theme i'm using:

<string>Trailing whitespace</string>

And set setting:

"highlight_trailing_spaces_color_name": "trailingspace"

Background color of trailing spaces should be reddish while I see white. I'm using twilight theme with this one simple modification.

When I use default "comment" scope then background is gray but when I use anything else, it's white.
Sublime uses the foreground color to fill those regions. So set your foreground color to your reddish one. You also might have to close and reopen your file to see the changes.