Mercurial > vim
diff runtime/syntax/diff.vim @ 23466:15fa3923cc49
Update runtime files.
Commit: https://github.com/vim/vim/commit/7e6a515ed14e204fafb3dd6e98f2fb543e64aedd
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 2 16:39:53 2021 +0100
Update runtime files.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 02 Jan 2021 16:45:04 +0100 |
parents | 99ef85ff1af4 |
children | 4027cefc2aab |
line wrap: on
line diff
--- 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: 2020 Dec 07 +" Last Change: 2020 Dec 30 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -348,11 +348,16 @@ syn match diffLine "^\d\+\(,\d\+\)\=[cda 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 diffOldFile "^+++ .*" -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.*"