2 " Language: git commit file
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.info>
4 " Filenames: *.git/COMMIT_EDITMSG
5 " Last Change: 2008 Apr 09
7 if exists("b:current_syntax")
18 syn include @gitcommitDiff syntax/diff.vim
19 syn region gitcommitDiff start=/\%(^diff --git \)\@=/ end=/^$\|^#\@=/ contains=@gitcommitDiff
21 syn match gitcommitFirstLine "\%^[^#].*" nextgroup=gitcommitBlank skipnl
22 syn match gitcommitSummary "^.\{0,50\}" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
23 syn match gitcommitOverflow ".*" contained contains=@Spell
24 syn match gitcommitBlank "^[^#].*" contained contains=@Spell
25 syn match gitcommitComment "^#.*"
26 syn region gitcommitHead start=/^# / end=/^#$/ contained transparent
27 syn match gitcommitOnBranch "\%(^# \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
28 syn match gitcommitBranch "\S\+" contained
29 syn match gitcommitHeader "\%(^# \)\@<=.*:$" contained containedin=gitcommitComment
31 syn region gitcommitUntracked start=/^# Untracked files:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUntrackedFile fold
32 syn match gitcommitUntrackedFile "\t\@<=.*" contained
34 syn region gitcommitDiscarded start=/^# Changed but not updated:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitDiscardedType fold
35 syn region gitcommitSelected start=/^# Changes to be committed:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold
37 syn match gitcommitDiscardedType "\t\@<=[a-z][a-z ]*[a-z]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite
38 syn match gitcommitSelectedType "\t\@<=[a-z][a-z ]*[a-z]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite
39 syn match gitcommitDiscardedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow
40 syn match gitcommitSelectedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
41 syn match gitcommitDiscardedArrow " -> " contained nextgroup=gitcommitDiscardedFile
42 syn match gitcommitSelectedArrow " -> " contained nextgroup=gitcommitSelectedFile
44 hi def link gitcommitSummary Keyword
45 hi def link gitcommitComment Comment
46 hi def link gitcommitUntracked gitcommitComment
47 hi def link gitcommitDiscarded gitcommitComment
48 hi def link gitcommitSelected gitcommitComment
49 hi def link gitcommitOnBranch Comment
50 hi def link gitcommitBranch Special
51 hi def link gitcommitDiscardedType gitcommitType
52 hi def link gitcommitSelectedType gitcommitType
53 hi def link gitcommitType Type
54 hi def link gitcommitHeader PreProc
55 hi def link gitcommitUntrackedFile gitcommitFile
56 hi def link gitcommitDiscardedFile gitcommitFile
57 hi def link gitcommitSelectedFile gitcommitFile
58 hi def link gitcommitFile Constant
59 hi def link gitcommitDiscardedArrow gitcommitArrow
60 hi def link gitcommitSelectedArrow gitcommitArrow
61 hi def link gitcommitArrow gitcommitComment
62 "hi def link gitcommitOverflow Error
63 hi def link gitcommitBlank Error
65 let b:current_syntax = "gitcommit"