Tuesday, February 2, 2021

Re: Highlight email headers with different colors

Ian N wrote:
> Thank you Christian!
> This is exactly what I have already done.
>
> Indeed, the mail.vim file highlights all the mail headers, with the
> same color (white in this case).
>
> My question is about how to customize these colors (when writing the
> mail) - say From: field blue, To: field red, ...
> I am trying to understand the mail.vim file. It seems it defines the
> mail header fields all together and colors them with one color.
>
> I am looking for a way to customize the mail header fields
> colors individually.
> Ian
>
You'll need to make a customized syntax/email.vim file. I suggest going
about this one field at a time.

Copy your system's email.vim into $HOME/.vim/syntax/email.vim.
Work with the copy:

Example:
    modify: syn region mailHeader ... remove "|from" from its start pattern
    new syntax: syn region mailHeaderFrom
    new highlighting: hi def mailHeaderFrom (whatever start= cterm=
gui= stuff you want)
    quoted regions: include mailHeaderFrom in mailQuoted[1-6]

Rinse and repeat for whatever fields you want to modify the highlighting
for.

Your version of email.vim will then override the system version, which
you should NOT modify. Future updates to vim could easily wipe your
modified email.vim away should you happen to modify the system version
in place.

Chip Campbell

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/2cf3381f-b2d1-5547-1807-2ed04538d8b7%40drchip.org.

No comments: