1*8c8de839SBram Moolenaar" Vim syntax file 2*8c8de839SBram Moolenaar" Language: git commit file 3*8c8de839SBram Moolenaar" Maintainer: Tim Pope <[email protected]> 4*8c8de839SBram Moolenaar" Filenames: *.git/COMMIT_EDITMSG 5*8c8de839SBram Moolenaar" Last Change: 2008 Apr 09 6*8c8de839SBram Moolenaar 7*8c8de839SBram Moolenaarif exists("b:current_syntax") 8*8c8de839SBram Moolenaar finish 9*8c8de839SBram Moolenaarendif 10*8c8de839SBram Moolenaar 11*8c8de839SBram Moolenaarsyn case match 12*8c8de839SBram Moolenaarsyn sync minlines=50 13*8c8de839SBram Moolenaar 14*8c8de839SBram Moolenaarif has("spell") 15*8c8de839SBram Moolenaar syn spell toplevel 16*8c8de839SBram Moolenaarendif 17*8c8de839SBram Moolenaar 18*8c8de839SBram Moolenaarsyn include @gitcommitDiff syntax/diff.vim 19*8c8de839SBram Moolenaarsyn region gitcommitDiff start=/\%(^diff --git \)\@=/ end=/^$\|^#\@=/ contains=@gitcommitDiff 20*8c8de839SBram Moolenaar 21*8c8de839SBram Moolenaarsyn match gitcommitFirstLine "\%^[^#].*" nextgroup=gitcommitBlank skipnl 22*8c8de839SBram Moolenaarsyn match gitcommitSummary "^.\{0,50\}" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell 23*8c8de839SBram Moolenaarsyn match gitcommitOverflow ".*" contained contains=@Spell 24*8c8de839SBram Moolenaarsyn match gitcommitBlank "^[^#].*" contained contains=@Spell 25*8c8de839SBram Moolenaarsyn match gitcommitComment "^#.*" 26*8c8de839SBram Moolenaarsyn region gitcommitHead start=/^# / end=/^#$/ contained transparent 27*8c8de839SBram Moolenaarsyn match gitcommitOnBranch "\%(^# \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite 28*8c8de839SBram Moolenaarsyn match gitcommitBranch "\S\+" contained 29*8c8de839SBram Moolenaarsyn match gitcommitHeader "\%(^# \)\@<=.*:$" contained containedin=gitcommitComment 30*8c8de839SBram Moolenaar 31*8c8de839SBram Moolenaarsyn region gitcommitUntracked start=/^# Untracked files:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUntrackedFile fold 32*8c8de839SBram Moolenaarsyn match gitcommitUntrackedFile "\t\@<=.*" contained 33*8c8de839SBram Moolenaar 34*8c8de839SBram Moolenaarsyn region gitcommitDiscarded start=/^# Changed but not updated:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitDiscardedType fold 35*8c8de839SBram Moolenaarsyn region gitcommitSelected start=/^# Changes to be committed:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold 36*8c8de839SBram Moolenaar 37*8c8de839SBram Moolenaarsyn match gitcommitDiscardedType "\t\@<=[a-z][a-z ]*[a-z]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite 38*8c8de839SBram Moolenaarsyn match gitcommitSelectedType "\t\@<=[a-z][a-z ]*[a-z]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite 39*8c8de839SBram Moolenaarsyn match gitcommitDiscardedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow 40*8c8de839SBram Moolenaarsyn match gitcommitSelectedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow 41*8c8de839SBram Moolenaarsyn match gitcommitDiscardedArrow " -> " contained nextgroup=gitcommitDiscardedFile 42*8c8de839SBram Moolenaarsyn match gitcommitSelectedArrow " -> " contained nextgroup=gitcommitSelectedFile 43*8c8de839SBram Moolenaar 44*8c8de839SBram Moolenaarhi def link gitcommitSummary Keyword 45*8c8de839SBram Moolenaarhi def link gitcommitComment Comment 46*8c8de839SBram Moolenaarhi def link gitcommitUntracked gitcommitComment 47*8c8de839SBram Moolenaarhi def link gitcommitDiscarded gitcommitComment 48*8c8de839SBram Moolenaarhi def link gitcommitSelected gitcommitComment 49*8c8de839SBram Moolenaarhi def link gitcommitOnBranch Comment 50*8c8de839SBram Moolenaarhi def link gitcommitBranch Special 51*8c8de839SBram Moolenaarhi def link gitcommitDiscardedType gitcommitType 52*8c8de839SBram Moolenaarhi def link gitcommitSelectedType gitcommitType 53*8c8de839SBram Moolenaarhi def link gitcommitType Type 54*8c8de839SBram Moolenaarhi def link gitcommitHeader PreProc 55*8c8de839SBram Moolenaarhi def link gitcommitUntrackedFile gitcommitFile 56*8c8de839SBram Moolenaarhi def link gitcommitDiscardedFile gitcommitFile 57*8c8de839SBram Moolenaarhi def link gitcommitSelectedFile gitcommitFile 58*8c8de839SBram Moolenaarhi def link gitcommitFile Constant 59*8c8de839SBram Moolenaarhi def link gitcommitDiscardedArrow gitcommitArrow 60*8c8de839SBram Moolenaarhi def link gitcommitSelectedArrow gitcommitArrow 61*8c8de839SBram Moolenaarhi def link gitcommitArrow gitcommitComment 62*8c8de839SBram Moolenaar"hi def link gitcommitOverflow Error 63*8c8de839SBram Moolenaarhi def link gitcommitBlank Error 64*8c8de839SBram Moolenaar 65*8c8de839SBram Moolenaarlet b:current_syntax = "gitcommit" 66