Display trailing spaces in vim
In terms of performance, none of these should make a difference. Vim mostly gets bogged down by complex syntax patterns; the pattern here is quite simple.
To make the highlight color agree with the chosen colorscheme, use :hi link
to an existing group; usually, that would be Error
. Of course, any of this only matters if you switch (quite different) colorschemes often; else, using suitable colors directly (as in your solution 1) would be fine, too.
Solution 1: Manually highlight trailing spaces
I'd go for this, but using matchadd()
instead of :match
; this leaves the latter for custom highlighting. Also, clearmatches()
is too coarse; it deletes all matches, and therefore may affect plugins. You can use / have a look at my ShowTrailingWhitespace plugin for a clean and powerful implementation (that also includes exceptions for certain filetypes). Yes, it's a much bigger solution, but I haven't notice any impact yet.
Solution 2: Using list feature
This is a useful feature in itself, and keeping it on permanently has effects on cursor positioning on Tab characters, so I wouldn't recommend that.
Solution 3: Using conceal feature
That will surely interfere with some syntaxes and plugins using the feature. Bad idea.