Skip to content

Highlight trailing whitespace by default? #125

Description

@joshtriplett

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions