bronson / vim-trailing-whitespace

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

Disable on non-writable buffers #23

Closed tssm closed 1 year ago

tssm commented 3 years ago

It doesn't make sense to highlight whitespace on non-writable buffers because they cannot be changed by the user. By :help buftype the only buffers we care about are those whose &buftype is either empty or acwrite

bronson commented 3 years ago

Personally I find it useful to see trailing whitespace in read-only buffers (mostly git diffs and files in /etc).

What you're saying does make sense though... I'll leave this open for a while and see if others agree or disagree.

tssm commented 3 years ago

Just as a reference a buffer with an empty buftype can still be read only, that depends on readonly and/or modifiable options. Confusing, I know 😅

bronson commented 3 years ago

Gotcha, because /etc files have an empty buftype, they still show whitespace. That makes sense. Thanks for explaining.

Fugitive buffers have a nowrite buftype ... I'd expect them to still show extra whitespace.

I understand not caring about whitespace in help and quickfix.

But what about prompt, popup, and maybe terminal? It seems like visible whitespace would still be useful there, wouldn't it?

And the last buftype is nofile ... I have no idea how nofile buffers are used. Not sure if they should show whitespace or not.

fogine commented 2 years ago

this should be made an option at least if you dont want to make it disabled permanently for non writable buffers

bronson commented 2 years ago

Sure, I'd merge a patch to make it an option.

Personally I still want to see whitespace in my Fugitive buffers.

bronson commented 1 year ago

Closing due to lack of progress. I’d still be interested in merging a patch that either works with fugitive or (if it’s simple) makes it configurable.