This way the correct ordering is always detected.
Signed-off-by: Felipe Contreras <[email protected]>
---
runtime/syntax/diff.vim | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/runtime/syntax/diff.vim b/runtime/syntax/diff.vim
index 31ca835bf..5673284d5 100644
--- a/runtime/syntax/diff.vim
+++ b/runtime/syntax/diff.vim
@@ -348,11 +348,16 @@ syn match diffLine "^\d\+\(,\d\+\)\=[cda]\d\+\>.*"
syn match diffFile "^diff\>.*"
syn match diffFile "^Index: .*"
syn match diffFile "^==== .*"
-" Old style diff uses *** for old and --- for new.
-" Unified diff uses --- for old and +++ for new; names are wrong but it works.
-syn match diffNewFile "^+++ .*"
-syn match diffNewFile "^\*\*\* .*"
-syn match diffOldFile "^--- .*"
+
+if search('^@@ -\S\+ +\S\+ @@', 'nw', '', 100)
+ " unified
+ syn match diffOldFile "^--- .*"
+ syn match diffNewFile "^+++ .*"
+else
+ " context
+ syn match diffOldFile "^\*\*\* .*"
+ syn match diffNewFile "^--- .*"
+endif
" Used by git
syn match diffIndexLine "^index \x\x\x\x.*"
--
2.30.0
--
--
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/20201230163823.550529-3-felipe.contreras%40gmail.com.