On Mon, Dec 7, 2020 at 11:54 AM Bram Moolenaar <[email protected]> wrote:
> Felipe Contreras wrote:
> > But it doesn't work. I want to distinguish the file ("^diff\>.*" aka
> > diffFile) from the new file ("^+++ .*" aka diffNewFile).
> >
> > So in my colorscheme I have diffNewFile: 'green', diffOldFile: 'red',
> > diffFile: 'blue' reversed.
> >
> > https://snipboard.io/BsmkiT.jpg
> >
> > How do you propose I distinguish diffFile from diffNewFile without my patch?
>
> Hmm, in unified diff the "***" marker isn't used, and in old style diff
> "+++" isn't used, so these could use the same highlight?
>
> Changing:
>
> syn match diffFile "^+++ .*"
>
> To:
>
> syn match diffOldFile "^+++ .*"
>
> Would work, right?
Yes. That works.
It's annoying that the order is reversed for the vastly most widely
used format, but it works.
Perhaps at least some comment?
--- a/runtime/syntax/diff.vim
+++ b/runtime/syntax/diff.vim
@@ -346,12 +346,14 @@ syn match diffLine "^---$"
syn match diffLine "^\d\+\(,\d\+\)\=[cda]\d\+\>.*"
syn match diffFile "^diff\>.*"
-syn match diffFile "^+++ .*"
syn match diffFile "^Index: .*"
syn match diffFile "^==== .*"
syn match diffOldFile "^\*\*\* .*"
syn match diffNewFile "^--- .*"
+" In unified diff this is actually the new file
+syn match diffOldFile "^+++ .*"
+
" Used by git
syn match diffIndexLine "^index \x\x\x\x.*"
--
Felipe Contreras
--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/CAMP44s1E0_rUDdXyC2uXj9TYnGLYvtMOTjXxdng4pF-wqRPzoA%40mail.gmail.com.