1624
|
1 " Vim syntax file
|
|
2 " Language: generic git output
|
2034
|
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
18818
|
4 " Last Change: 2019 Dec 05
|
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=/^$/
|
18818
|
16 syn region gitHead start=/\%(^commit\%( \x\{40\}\)\{1,\}\%(\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
|
18818
|
28 syn match gitDiffAdded "{+.*+}" contained containedin=gitDiff
|
2034
|
29 syn match gitDiffRemoved "^ \+-.*" contained containedin=gitDiffMerge
|
18818
|
30 syn match gitDiffRemoved "\[-.*-\]" contained containedin=gitDiff
|
1624
|
31
|
|
32 syn match gitKeyword /^\%(object\|type\|tag\|commit\|tree\|parent\|encoding\)\>/ contained containedin=gitHead nextgroup=gitHash,gitType skipwhite
|
|
33 syn match gitKeyword /^\%(tag\>\|ref:\)/ contained containedin=gitHead nextgroup=gitReference skipwhite
|
|
34 syn match gitKeyword /^Merge:/ contained containedin=gitHead nextgroup=gitHashAbbrev skipwhite
|
18818
|
35 syn match gitMode /^\d\{6\}\>/ contained containedin=gitHead nextgroup=gitType,gitHash skipwhite
|
1624
|
36 syn match gitIdentityKeyword /^\%(author\|committer\|tagger\)\>/ contained containedin=gitHead nextgroup=gitIdentity skipwhite
|
|
37 syn match gitIdentityHeader /^\%(Author\|Commit\|Tagger\):/ contained containedin=gitHead nextgroup=gitIdentity skipwhite
|
|
38 syn match gitDateHeader /^\%(AuthorDate\|CommitDate\|Date\):/ contained containedin=gitHead nextgroup=gitDate skipwhite
|
|
39
|
|
40 syn match gitReflogHeader /^Reflog:/ contained containedin=gitHead nextgroup=gitReflogMiddle skipwhite
|
|
41 syn match gitReflogHeader /^Reflog message:/ contained containedin=gitHead skipwhite
|
|
42 syn match gitReflogMiddle /\S\+@{\d\+} (/he=e-2 nextgroup=gitIdentity
|
|
43
|
|
44 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
|
|
45 syn match gitDate /-\=\d\+ [+-]\d\d\d\d\>/ contained
|
|
46 syn match gitDate /\<\d\+ \l\+ ago\>/ contained
|
|
47 syn match gitType /\<\%(tag\|commit\|tree\|blob\)\>/ contained nextgroup=gitHash skipwhite
|
|
48 syn match gitStage /\<\d\t\@=/ contained
|
|
49 syn match gitReference /\S\+\S\@!/ contained
|
2034
|
50 syn match gitHash /\<\x\{40\}\>/ contained nextgroup=gitIdentity,gitStage,gitHash skipwhite
|
1624
|
51 syn match gitHash /^\<\x\{40\}\>/ containedin=gitHead contained nextgroup=gitHash skipwhite
|
2034
|
52 syn match gitHashAbbrev /\<\x\{4,40\}\>/ contained nextgroup=gitHashAbbrev skipwhite
|
1624
|
53 syn match gitHashAbbrev /\<\x\{4,39\}\.\.\./he=e-3 contained nextgroup=gitHashAbbrev skipwhite
|
2034
|
54
|
|
55 syn match gitIdentity /\S.\{-\} <[^>]*>/ contained nextgroup=gitDate skipwhite
|
|
56 syn region gitEmail matchgroup=gitEmailDelimiter start=/</ end=/>/ keepend oneline contained containedin=gitIdentity
|
|
57
|
|
58 syn match gitNotesHeader /^Notes:\ze\n /
|
1624
|
59
|
|
60 hi def link gitDateHeader gitIdentityHeader
|
|
61 hi def link gitIdentityHeader gitIdentityKeyword
|
|
62 hi def link gitIdentityKeyword Label
|
2034
|
63 hi def link gitNotesHeader gitKeyword
|
1624
|
64 hi def link gitReflogHeader gitKeyword
|
|
65 hi def link gitKeyword Keyword
|
|
66 hi def link gitIdentity String
|
|
67 hi def link gitEmailDelimiter Delimiter
|
|
68 hi def link gitEmail Special
|
|
69 hi def link gitDate Number
|
|
70 hi def link gitMode Number
|
|
71 hi def link gitHashAbbrev gitHash
|
|
72 hi def link gitHash Identifier
|
|
73 hi def link gitReflogMiddle gitReference
|
|
74 hi def link gitReference Function
|
|
75 hi def link gitStage gitType
|
|
76 hi def link gitType Type
|
2034
|
77 hi def link gitDiffAdded diffAdded
|
|
78 hi def link gitDiffRemoved diffRemoved
|
1624
|
79
|
|
80 let b:current_syntax = "git"
|