Felipe Contreras wrote:
> > > Nowadays most people use the unified diff, which has this format: > > > > > > --- a/foo > > > +++ b/foo > > > > > > In that case the old file starts with '---', but currently that's > > > considered the new file, since the old context format is like: > > > > > > *** a/foo > > > --- b/foo > > > > > > Let's use the modern format by default, and leave the option for users > > > to use the old format with `diff_context = 1`. > > > > > > Signed-off-by: Felipe Contreras <[email protected]> > > > --- > > > runtime/syntax/diff.vim | 10 +++++++--- > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > > > diff --git a/runtime/syntax/diff.vim b/runtime/syntax/diff.vim > > > index b656cd97a..b9e5131e0 100644 > > > --- a/runtime/syntax/diff.vim > > > +++ b/runtime/syntax/diff.vim > > > @@ -346,11 +346,15 @@ 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 "^--- .*" > > > +if !exists("diff_context") > > > + syn match diffOldFile "^--- .*" > > > + syn match diffNewFile "^+++ .*" > > > +else > > > + syn match diffOldFile "^\*\*\* .*" > > > + syn match diffNewFile "^--- .*" > > > +end > > > > > > " Used by git > > > syn match diffIndexLine "^index \x\x\x\x.*" > > > > I do not see a reason to omit highlighting +++, in a context diff you > > would not find them. > > There's no reason to omit them. > > > Your patch makes the name more accurate, but at the same time makes it > > more complicated. If you don't mind the name for the highlight group, > > it just works already. > > 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? -- Q: Why does /dev/null accept only integers? A: You can't sink a float. /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- 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/202012071754.0B7Hsg7h1418690%40masaka.moolenaar.net.
