I realise that in vim, I can highlight trailing spaces at the end of a line using
match /\s\+$/
Now I would like to exclude those lines that contain exactly one space from being matched. How do I go about doing this? (It does not need to be a single line/regex.)
match /\(\S\zs\s\+$\)\|\(^\s\{2,}$\)/This should work – breaking it down into 2 sections
Part 1 – search for spaces at the end of a line that has other stuff on the line:
\(\S\zs\s\+$\)not a space
\S,then start matching
\zs,1 or more spaces at the end of the line
\s\+$OR match
\|Part 2 – Search for more than one space which is the entire line:
\(^\s\{2,}$\)start at the beginning of the line
^search for at least 2 spaces
\s\{2,}at the end of the line
$