Sublime Forum

[Feature Request] Highlight/strip trailing spaces/tabs

#1

Is it possible to add an option to highlight trailing spaces/tabs when viewing files in Sublime Merge?
It would be nice to strip them also. Although if you know they are there you can always fire up Sublime Text3 and do it there.

1 Like

#2

I would really like this too. Git’s CLI highlights trailing spaces so I think it’s fair to expect Sublime Merge to do that too.

Sublime Text has a TrailingSpaces package I use - wondering if that has any reusable code in it?

0 Likes

#3

I accomplished the highlighting by customizing the syntax
(would be nice to have a way to augment an existing syntax without having to copy the entire file)…

For example for C: I copied the C.sublime-syntax out of the C++.sublime-package and added:

   - match: [ \t]+$
     scope: invalid.illegal.trailing-whitespaces-*section*.c

to the following sections (changing the *section* to an appropriate name)

  • comments
  • preprocessor-line-continuation
  • preprocessor-comments
  • early-expressions
0 Likes