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.*"
-- 
2.29.2

-- 
-- 
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/20201206014526.1612556-1-felipe.contreras%40gmail.com.

Raspunde prin e-mail lui