2 " Language: Diff (context or unified)
3 " Maintainer: Bram Moolenaar <Bram@vim.org>
4 " Last Change: 2001 May 10
6 " For version 5.x: Clear all syntax items
7 " For version 6.x: Quit when a syntax file was already loaded
10 elseif exists("b:current_syntax")
14 syn match diffOnly "^Only in .*"
15 syn match diffIdentical "^Files .* and .* are identical$"
16 syn match diffDiffer "^Files .* and .* differ$"
17 syn match diffBDiffer "^Binary files .* and .* differ$"
18 syn match diffIsA "^File .* is a .* while file .* is a .*"
19 syn match diffNoEOL "^No newline at end of file .*"
21 syn match diffRemoved "^-.*"
22 syn match diffRemoved "^<.*"
23 syn match diffAdded "^+.*"
24 syn match diffAdded "^>.*"
25 syn match diffChanged "^! .*"
27 syn match diffSubname " @@..*"ms=s+3 contained
28 syn match diffLine "^@.*" contains=diffSubname
29 syn match diffLine "^\<\d\+\>.*"
30 syn match diffLine "^\*\*\*\*.*"
32 "Some versions of diff have lines like "#c#" and "#d#" (where # is a number)
33 syn match diffLine "^\d\+\(,\d\+\)\=[cda]\d\+\>.*"
35 syn match diffFile "^diff.*"
36 syn match diffFile "^+++ .*"
37 syn match diffFile "^Index: .*$"
38 syn match diffFile "^==== .*$"
39 syn match diffOldFile "^\*\*\* .*"
40 syn match diffNewFile "^--- .*"
42 syn match diffComment "^#.*"
44 " Define the default highlighting.
45 " For version 5.7 and earlier: only when not done already
46 " For version 5.8 and later: only when an item doesn't have highlighting yet
47 if version >= 508 || !exists("did_diff_syntax_inits")
49 let did_diff_syntax_inits = 1
50 command -nargs=+ HiLink hi link <args>
52 command -nargs=+ HiLink hi def link <args>
55 HiLink diffOldFile diffFile
56 HiLink diffNewFile diffFile
58 HiLink diffOnly Constant
59 HiLink diffIdentical Constant
60 HiLink diffDiffer Constant
61 HiLink diffBDiffer Constant
62 HiLink diffIsA Constant
63 HiLink diffNoEOL Constant
64 HiLink diffRemoved Special
65 HiLink diffChanged PreProc
66 HiLink diffAdded Identifier
67 HiLink diffLine Statement
68 HiLink diffSubname PreProc
69 HiLink diffComment Comment
74 let b:current_syntax = "diff"