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