aboutsummaryrefslogtreecommitdiff
path: root/runtime/syntax/diff.vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/syntax/diff.vim')
-rw-r--r--runtime/syntax/diff.vim15
1 files changed, 11 insertions, 4 deletions
diff --git a/runtime/syntax/diff.vim b/runtime/syntax/diff.vim
index b656cd97a6..408556ac13 100644
--- a/runtime/syntax/diff.vim
+++ b/runtime/syntax/diff.vim
@@ -2,7 +2,7 @@
" Language: Diff (context or unified)
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Translations by Jakson Alves de Aquino.
-" Last Change: 2016 Apr 02
+" Last Change: 2020 Dec 30
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
@@ -346,11 +346,18 @@ 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 search('^@@ -\S\+ +\S\+ @@', 'nw', '', 100)
+ " unified
+ syn match diffOldFile "^--- .*"
+ syn match diffNewFile "^+++ .*"
+else
+ " context / old style
+ syn match diffOldFile "^\*\*\* .*"
+ syn match diffNewFile "^--- .*"
+endif
" Used by git
syn match diffIndexLine "^index \x\x\x\x.*"