1624
|
1 " Vim syntax file
|
|
2 " Language: generic git output
|
2034
|
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
2202
|
4 " Last Change: 2010 May 21
|
1624
|
5
|
|
6 if exists("b:current_syntax")
|
2202
|
7 finish
|
1624
|
8 endif
|
|
9
|
|
10 syn case match
|
|
11 syn sync minlines=50
|
|
12
|
|
13 syn include @gitDiff syntax/diff.vim
|
|
14
|
|
15 syn region gitHead start=/\%^/ end=/^$/
|
2034
|
16 syn region gitHead start=/\%(^commit \x\{40\}\%(\s*(.*)\)\=$\)\@=/ end=/^$/
|
1624
|
17
|
|
18 " For git reflog and git show ...^{tree}, avoid sync issues
|
|
19 syn match gitHead /^\d\{6\} \%(\w\{4} \)\=\x\{40\}\%( [0-3]\)\=\t.*/
|
|
20 syn match gitHead /^\x\{40\} \x\{40}\t.*/
|
|
21
|
2034
|
22 syn region gitDiff start=/^\%(diff --git \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff fold
|
|
23 syn region gitDiff start=/^\%(@@ -\)\@=/ end=/^\%(diff --\%(git\|cc\|combined\) \|$\)\@=/ contains=@gitDiff
|
|
24
|
|
25 syn region gitDiffMerge start=/^\%(diff --\%(cc\|combined\) \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff
|
|
26 syn region gitDiffMerge start=/^\%(@@@@* -\)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff
|
|
27 syn match gitDiffAdded "^ \++.*" contained containedin=gitDiffMerge
|
|
28 syn match gitDiffRemoved "^ \+-.*" contained containedin=gitDiffMerge
|
1624
|
29
|
|
30 syn match gitKeyword /^\%(object\|type\|tag\|commit\|tree\|parent\|encoding\)\>/ contained containedin=gitHead nextgroup=gitHash,gitType skipwhite
|
|
31 syn match gitKeyword /^\%(tag\>\|ref:\)/ contained containedin=gitHead nextgroup=gitReference skipwhite
|
|
32 syn match gitKeyword /^Merge:/ contained containedin=gitHead nextgroup=gitHashAbbrev skipwhite
|
|
33 syn match gitMode /^\d\{6\}/ contained containedin=gitHead nextgroup=gitType,gitHash skipwhite
|
|
34 syn match gitIdentityKeyword /^\%(author\|committer\|tagger\)\>/ contained containedin=gitHead nextgroup=gitIdentity skipwhite
|
|
35 syn match gitIdentityHeader /^\%(Author\|Commit\|Tagger\):/ contained containedin=gitHead nextgroup=gitIdentity skipwhite
|
|
36 syn match gitDateHeader /^\%(AuthorDate\|CommitDate\|Date\):/ contained containedin=gitHead nextgroup=gitDate skipwhite
|
|
37
|
|
38 syn match gitReflogHeader /^Reflog:/ contained containedin=gitHead nextgroup=gitReflogMiddle skipwhite
|
|
39 syn match gitReflogHeader /^Reflog message:/ contained containedin=gitHead skipwhite
|
|
40 syn match gitReflogMiddle /\S\+@{\d\+} (/he=e-2 nextgroup=gitIdentity
|
|
41
|
|
42 syn match gitDate /\<\u\l\l \u\l\l \d\=\d \d\d:\d\d:\d\d \d\d\d\d [+-]\d\d\d\d/ contained
|
|
43 syn match gitDate /-\=\d\+ [+-]\d\d\d\d\>/ contained
|
|
44 syn match gitDate /\<\d\+ \l\+ ago\>/ contained
|
|
45 syn match gitType /\<\%(tag\|commit\|tree\|blob\)\>/ contained nextgroup=gitHash skipwhite
|
|
46 syn match gitStage /\<\d\t\@=/ contained
|
|
47 syn match gitReference /\S\+\S\@!/ contained
|
2034
|
48 syn match gitHash /\<\x\{40\}\>/ contained nextgroup=gitIdentity,gitStage,gitHash skipwhite
|
1624
|
49 syn match gitHash /^\<\x\{40\}\>/ containedin=gitHead contained nextgroup=gitHash skipwhite
|
2034
|
50 syn match gitHashAbbrev /\<\x\{4,40\}\>/ contained nextgroup=gitHashAbbrev skipwhite
|
1624
|
51 syn match gitHashAbbrev /\<\x\{4,39\}\.\.\./he=e-3 contained nextgroup=gitHashAbbrev skipwhite
|
2034
|
52
|
|
53 syn match gitIdentity /\S.\{-\} <[^>]*>/ contained nextgroup=gitDate skipwhite
|
|
54 syn region gitEmail matchgroup=gitEmailDelimiter start=/</ end=/>/ keepend oneline contained containedin=gitIdentity
|
|
55
|
|
56 syn match gitNotesHeader /^Notes:\ze\n /
|
1624
|
57
|
|
58 hi def link gitDateHeader gitIdentityHeader
|
|
59 hi def link gitIdentityHeader gitIdentityKeyword
|
|
60 hi def link gitIdentityKeyword Label
|
2034
|
61 hi def link gitNotesHeader gitKeyword
|
1624
|
62 hi def link gitReflogHeader gitKeyword
|
|
63 hi def link gitKeyword Keyword
|
|
64 hi def link gitIdentity String
|
|
65 hi def link gitEmailDelimiter Delimiter
|
|
66 hi def link gitEmail Special
|
|
67 hi def link gitDate Number
|
|
68 hi def link gitMode Number
|
|
69 hi def link gitHashAbbrev gitHash
|
|
70 hi def link gitHash Identifier
|
|
71 hi def link gitReflogMiddle gitReference
|
|
72 hi def link gitReference Function
|
|
73 hi def link gitStage gitType
|
|
74 hi def link gitType Type
|
2034
|
75 hi def link gitDiffAdded diffAdded
|
|
76 hi def link gitDiffRemoved diffRemoved
|
1624
|
77
|
|
78 let b:current_syntax = "git"
|