Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on Syntax match any 2 spaces at end of line
Post
Syntax match any 2 spaces at end of line
I'm using the following syntax match to conceal 2 spaces at the end of a line with a special character.
syntax match Normal '\s\{2}$' conceal cchar=⏎
A line with two spaces at the end of it would display like this:
some line with two trailing spaces⏎
However, if there are more than two spaces I don't get the special character. I would expect that this would still match on the last two spaces. For example:
a line with 4 trailing spaces ⏎
Instead, it shows all 4 spaces with no special character.
If I do a normal search for /\s\{2}$
, it will find 2 spaces at the end of the line, even if there are additional preceding spaces. Whereas the syntax match
still matches if other characters proceed 2 trailing spaces, but not if the proceeding characters are spaces.
Why doesn't my syntax match work if there are proceeding spaces? How can I match 2 trailing spaces on a line, even if there are additional spaces before it?
1 comment thread