1" Vim syntax file 2" Language: git commit file 3" Maintainer: Tim Pope <[email protected]> 4" Filenames: *.git/COMMIT_EDITMSG 5" Last Change: 2019 Dec 05 6 7if exists("b:current_syntax") 8 finish 9endif 10 11syn case match 12syn sync minlines=50 13 14if has("spell") 15 syn spell toplevel 16endif 17 18syn include @gitcommitDiff syntax/diff.vim 19syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|#\)\@=/ fold contains=@gitcommitDiff 20 21syn match gitcommitSummary "^.*\%<51v." contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell 22syn match gitcommitOverflow ".*" contained contains=@Spell 23syn match gitcommitBlank "^[^#].*" contained contains=@Spell 24 25if get(g:, "gitcommit_cleanup") is# "scissors" 26 syn match gitcommitFirstLine "\%^.*" nextgroup=gitcommitBlank skipnl 27 syn region gitcommitComment start=/^# -\+ >8 -\+$/ end=/\%$/ contains=gitcommitDiff 28else 29 syn match gitcommitFirstLine "\%^[^#].*" nextgroup=gitcommitBlank skipnl 30 syn match gitcommitComment "^#.*" 31endif 32 33syn match gitcommitHead "^\%(# .*\n\)\+#$" contained transparent 34syn match gitcommitOnBranch "\%(^# \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite 35syn match gitcommitOnBranch "\%(^# \)\@<=Your branch .\{-\} '" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite 36syn match gitcommitBranch "[^ ']\+" contained 37syn match gitcommitNoBranch "\%(^# \)\@<=Not currently on any branch." contained containedin=gitcommitComment 38syn match gitcommitHeader "\%(^# \)\@<=.*:$" contained containedin=gitcommitComment 39syn region gitcommitAuthor matchgroup=gitCommitHeader start=/\%(^# \)\@<=\%(Author\|Committer\):/ end=/$/ keepend oneline contained containedin=gitcommitComment transparent 40syn match gitcommitNoChanges "\%(^# \)\@<=No changes$" contained containedin=gitcommitComment 41 42syn region gitcommitUntracked start=/^# Untracked files:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUntrackedFile fold 43syn match gitcommitUntrackedFile "\t\@<=.*" contained 44 45syn region gitcommitDiscarded start=/^# Change\%(s not staged for commit\|d but not updated\):/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitDiscardedType fold 46syn region gitcommitSelected start=/^# Changes to be committed:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold 47syn region gitcommitUnmerged start=/^# Unmerged paths:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUnmergedType fold 48 49 50syn match gitcommitDiscardedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite 51syn match gitcommitSelectedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite 52syn match gitcommitUnmergedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitUnmergedFile skipwhite 53syn match gitcommitDiscardedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow 54syn match gitcommitSelectedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow 55syn match gitcommitUnmergedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow 56syn match gitcommitDiscardedArrow " -> " contained nextgroup=gitcommitDiscardedFile 57syn match gitcommitSelectedArrow " -> " contained nextgroup=gitcommitSelectedFile 58syn match gitcommitUnmergedArrow " -> " contained nextgroup=gitcommitSelectedFile 59 60syn match gitcommitWarning "\%^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl 61syn match gitcommitWarning "^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl contained 62syn match gitcommitWarning "^\%(no changes added to commit\|nothing \%(added \)\=to commit\)\>.*\%$" 63 64hi def link gitcommitSummary Keyword 65hi def link gitcommitComment Comment 66hi def link gitcommitUntracked gitcommitComment 67hi def link gitcommitDiscarded gitcommitComment 68hi def link gitcommitSelected gitcommitComment 69hi def link gitcommitUnmerged gitcommitComment 70hi def link gitcommitOnBranch Comment 71hi def link gitcommitBranch Special 72hi def link gitcommitNoBranch gitCommitBranch 73hi def link gitcommitDiscardedType gitcommitType 74hi def link gitcommitSelectedType gitcommitType 75hi def link gitcommitUnmergedType gitcommitType 76hi def link gitcommitType Type 77hi def link gitcommitNoChanges gitcommitHeader 78hi def link gitcommitHeader PreProc 79hi def link gitcommitUntrackedFile gitcommitFile 80hi def link gitcommitDiscardedFile gitcommitFile 81hi def link gitcommitSelectedFile gitcommitFile 82hi def link gitcommitUnmergedFile gitcommitFile 83hi def link gitcommitFile Constant 84hi def link gitcommitDiscardedArrow gitcommitArrow 85hi def link gitcommitSelectedArrow gitcommitArrow 86hi def link gitcommitUnmergedArrow gitcommitArrow 87hi def link gitcommitArrow gitcommitComment 88"hi def link gitcommitOverflow Error 89hi def link gitcommitBlank Error 90 91let b:current_syntax = "gitcommit" 92