What is the best way to color diff, quoted in Mutt, using Vim?
If I receive a diff as attachment, I want to comment some lines, but while replying mutt adds the quotation mark (>
) which is fine for me, but then it breaks the diff coloration in Vim.
How to add to the current diff pattern to match even with the first >
chars? (It would be better to match more ^[> ]
patterns)
Example of diff quoted message:
> @@ -52,22 +48,17 @@
> -msgid "foo is deprecated."
> +msgid "bar is deprecated."
I'd start by writing a custom syntax file, say ~/.vim/syntax/muttdiff.vim:
syn match quote "^>* "
syn match quotedDeletion "^>* *-.*" contains=quote
syn match quotedAddition "^>* *+.*" contains=quote
hi quotedDeletion ctermfg=red
hi quotedAddition ctermfg=green
hi quote ctermfg=white
And make vim source the file if it is editing a mutt message.
It's a good start if you want to learn how to create a custom syntax file for vim.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With