Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Diff (context or unified) |
| 3 | " Maintainer: Bram Moolenaar <Bram@vim.org> |
| 4 | " Last Change: 2003 Apr 02 |
| 5 | |
| 6 | " For version 5.x: Clear all syntax items |
| 7 | " For version 6.x: Quit when a syntax file was already loaded |
| 8 | if version < 600 |
| 9 | syntax clear |
| 10 | elseif exists("b:current_syntax") |
| 11 | finish |
| 12 | endif |
| 13 | |
| 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 .*" |
| 20 | syn match diffCommon "^Common subdirectories: .*" |
| 21 | |
| 22 | syn match diffRemoved "^-.*" |
| 23 | syn match diffRemoved "^<.*" |
| 24 | syn match diffAdded "^+.*" |
| 25 | syn match diffAdded "^>.*" |
| 26 | syn match diffChanged "^! .*" |
| 27 | |
| 28 | syn match diffSubname " @@..*"ms=s+3 contained |
| 29 | syn match diffLine "^@.*" contains=diffSubname |
| 30 | syn match diffLine "^\<\d\+\>.*" |
| 31 | syn match diffLine "^\*\*\*\*.*" |
| 32 | |
| 33 | "Some versions of diff have lines like "#c#" and "#d#" (where # is a number) |
| 34 | syn match diffLine "^\d\+\(,\d\+\)\=[cda]\d\+\>.*" |
| 35 | |
| 36 | syn match diffFile "^diff.*" |
| 37 | syn match diffFile "^+++ .*" |
| 38 | syn match diffFile "^Index: .*$" |
| 39 | syn match diffFile "^==== .*$" |
| 40 | syn match diffOldFile "^\*\*\* .*" |
| 41 | syn match diffNewFile "^--- .*" |
| 42 | |
| 43 | syn match diffComment "^#.*" |
| 44 | |
| 45 | " Define the default highlighting. |
| 46 | " For version 5.7 and earlier: only when not done already |
| 47 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 48 | if version >= 508 || !exists("did_diff_syntax_inits") |
| 49 | if version < 508 |
| 50 | let did_diff_syntax_inits = 1 |
| 51 | command -nargs=+ HiLink hi link <args> |
| 52 | else |
| 53 | command -nargs=+ HiLink hi def link <args> |
| 54 | endif |
| 55 | |
| 56 | HiLink diffOldFile diffFile |
| 57 | HiLink diffNewFile diffFile |
| 58 | HiLink diffFile Type |
| 59 | HiLink diffOnly Constant |
| 60 | HiLink diffIdentical Constant |
| 61 | HiLink diffDiffer Constant |
| 62 | HiLink diffBDiffer Constant |
| 63 | HiLink diffIsA Constant |
| 64 | HiLink diffNoEOL Constant |
| 65 | HiLink diffCommon Constant |
| 66 | HiLink diffRemoved Special |
| 67 | HiLink diffChanged PreProc |
| 68 | HiLink diffAdded Identifier |
| 69 | HiLink diffLine Statement |
| 70 | HiLink diffSubname PreProc |
| 71 | HiLink diffComment Comment |
| 72 | |
| 73 | delcommand HiLink |
| 74 | endif |
| 75 | |
| 76 | let b:current_syntax = "diff" |
| 77 | |
| 78 | " vim: ts=8 sw=2 |