Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight trailing whitespace by default? #125

Open
joshtriplett opened this issue Jun 16, 2016 · 2 comments
Open

Highlight trailing whitespace by default? #125

joshtriplett opened this issue Jun 16, 2016 · 2 comments

Comments

@joshtriplett
Copy link
Contributor

Issue #5 discussed the reasons to not set list by default. The pros were that it helps people be less sloppy with whitespace, and makes it easier to navigate by paragraphs by flagging lines that look blank but contain whitespace. The cons were that it breaks copy/paste from a terminal and adds clutter.

I'd like to propose highlighting trailing whitespace by default, and possibly also space-before-tab errors. This focuses on the most common and annoying forms of whitespace sloppiness, eliminates the clutter caused by showing visible characters for spaces and tabs, and does not affect copy/paste at all. In addition, to avoid the noise of highlighting trailing spaces while in the middle of typing, I'd suggest not highlighting trailing spaces at the current cursor position.

The following .vimrc snippet implements this:

highlight link sensibleWhitespaceError Error
autocmd Syntax * syntax match sensibleWhitespaceError excludenl /\s\+\%#\@<!$\| \+\ze\t/ display containedin=ALL
@LucasD11
Copy link

Or maybe at least use this settings for some language.

@hholst80
Copy link

IMHO, this is less of an issue now, as editors like Neovim have EditorConfig built in. The risk that someone has a perfectly legit use case for using trailing spaces and they pop-ups as an "error" seems to me to be unacceptable for a setting that "everyone can agree upon."

https://neovim.io/doc/user/editorconfig.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants