Thursday, January 17, 2019

Syntax-highlighting last character in a line

Hello,

I am trying to transition to format=flowed for e-mails, which is
harder than it should be. I'd like to enlist vim to help me.

What I would like to achieve is to highlight any final characters of
a line that aren't spaces, i.e. /\S$/, unless the line is followed
by an empty line. The idea is that I I'll be visually alerted to
lines in paragraphs that don't fit the format=flowed structure.

Using "match Error /\S$/" works, but that also covers quotes,
signature, and header, where format=flowed doesn't really apply. And
it highlights the final character of the last line of a paragraph,
which it shouldn't.

I'd like to restrict the matching to just the plain text in the mail
body, more specifically to all but the last line of a paragraph
(where paragraphs are separated by an empty line).

This sounds like syntax highlighting to me.

Syntax highlighting for mails in Vim already knows when I am in the
plain text (synID == 0). How can I leverage this knowledge and add
a new syntax highlighting?

At this stage, I cannot even get any result out of

syn match mailBodyTrailingNonspace "/\S$"

and I would appreciate if anyone could provide me with any clues.

Thank you!

--
@martinkrafft | https://riot.im/app/#/room/#madduck:madduck.net

"the truth is rarely pure and never simple. modern life would be very
tedious if it were either, and modern literature a complete
impossibility!"
-- oscar wilde

spamtraps: madduck.bogus@madduck.net

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment