bronson / vim-trailing-whitespace

Highlights trailing whitespace in red and provides :FixWhitespace to fix it.
453 stars 62 forks source link

Do not remove whitespace that is preceeded by if backslash #13

Closed hugomg closed 8 years ago

hugomg commented 9 years ago

Trailing whitespace can be useful in .vimrc files if we want to set a string property that ends in whitespace. For example:

set showbreak=↪\ \ \

This change adds a "\@<!" at the start of every regex in the plugin

bronson commented 8 years ago

... so "\ " at the end of a line won't ever be highlighted as an error. This makes sense.

I worry about performance in large files but I figure we can mere it and back out if it's too slow.

@hugomg could you rebase this on master? Sorry for the delay. :-/

hugomg commented 8 years ago

I'm a bit rusty on my git-fu right now and don't remember how to rebase a pull request. Do you think you can do it for me?

The basic change is what I described before: add a \\@<! to the start of all the whitespace regexes. It means "not preceded by backslash".

bronson commented 8 years ago

Yes, I owe you that. :) Merged, thanks!