xref: /vim-8.2.3635/runtime/syntax/gitcommit.vim (revision 53bfca22)
18c8de839SBram Moolenaar" Vim syntax file
28c8de839SBram Moolenaar" Language:	git commit file
35c73622aSBram Moolenaar" Maintainer:	Tim Pope <[email protected]>
48c8de839SBram Moolenaar" Filenames:	*.git/COMMIT_EDITMSG
5*53bfca22SBram Moolenaar" Last Change:	2012 April 7
68c8de839SBram Moolenaar
78c8de839SBram Moolenaarif exists("b:current_syntax")
88c8de839SBram Moolenaar  finish
98c8de839SBram Moolenaarendif
108c8de839SBram Moolenaar
118c8de839SBram Moolenaarsyn case match
128c8de839SBram Moolenaarsyn sync minlines=50
138c8de839SBram Moolenaar
148c8de839SBram Moolenaarif has("spell")
158c8de839SBram Moolenaar  syn spell toplevel
168c8de839SBram Moolenaarendif
178c8de839SBram Moolenaar
188c8de839SBram Moolenaarsyn include @gitcommitDiff syntax/diff.vim
19*53bfca22SBram Moolenaarsyn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|#\)\@=/ fold contains=@gitcommitDiff
208c8de839SBram Moolenaar
218c8de839SBram Moolenaarsyn match   gitcommitFirstLine	"\%^[^#].*"  nextgroup=gitcommitBlank skipnl
228c8de839SBram Moolenaarsyn match   gitcommitSummary	"^.\{0,50\}" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
238c8de839SBram Moolenaarsyn match   gitcommitOverflow	".*" contained contains=@Spell
248c8de839SBram Moolenaarsyn match   gitcommitBlank	"^[^#].*" contained contains=@Spell
258c8de839SBram Moolenaarsyn match   gitcommitComment	"^#.*"
265c73622aSBram Moolenaarsyn match   gitcommitHead	"^\%(#   .*\n\)\+#$" contained transparent
278c8de839SBram Moolenaarsyn match   gitcommitOnBranch	"\%(^# \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
285c73622aSBram Moolenaarsyn match   gitcommitOnBranch	"\%(^# \)\@<=Your branch .\{-\} '" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
29*53bfca22SBram Moolenaarsyn match   gitcommitBranch	"[^ ']\+" contained
305c73622aSBram Moolenaarsyn match   gitcommitNoBranch	"\%(^# \)\@<=Not currently on any branch." contained containedin=gitcommitComment
318c8de839SBram Moolenaarsyn match   gitcommitHeader	"\%(^# \)\@<=.*:$"	contained containedin=gitcommitComment
327a329911SBram Moolenaarsyn region  gitcommitAuthor	matchgroup=gitCommitHeader start=/\%(^# \)\@<=\%(Author\|Committer\):/ end=/$/ keepend oneline contained containedin=gitcommitComment transparent
335c73622aSBram Moolenaarsyn match   gitcommitNoChanges	"\%(^# \)\@<=No changes$" contained containedin=gitcommitComment
348c8de839SBram Moolenaar
358c8de839SBram Moolenaarsyn region  gitcommitUntracked	start=/^# Untracked files:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUntrackedFile fold
368c8de839SBram Moolenaarsyn match   gitcommitUntrackedFile  "\t\@<=.*"	contained
378c8de839SBram Moolenaar
38*53bfca22SBram Moolenaarsyn region  gitcommitDiscarded	start=/^# Change\%(s not staged for commit\|d but not updated\):/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitDiscardedType fold
398c8de839SBram Moolenaarsyn region  gitcommitSelected	start=/^# Changes to be committed:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold
405c73622aSBram Moolenaarsyn region  gitcommitUnmerged	start=/^# Unmerged paths:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUnmergedType fold
418c8de839SBram Moolenaar
428c8de839SBram Moolenaarsyn match   gitcommitDiscardedType	"\t\@<=[a-z][a-z ]*[a-z]: "he=e-2	contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite
438c8de839SBram Moolenaarsyn match   gitcommitSelectedType	"\t\@<=[a-z][a-z ]*[a-z]: "he=e-2	contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite
445c73622aSBram Moolenaarsyn match   gitcommitUnmergedType	"\t\@<=[a-z][a-z ]*[a-z]: "he=e-2	contained containedin=gitcommitComment nextgroup=gitcommitUnmergedFile skipwhite
458c8de839SBram Moolenaarsyn match   gitcommitDiscardedFile	".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow
468c8de839SBram Moolenaarsyn match   gitcommitSelectedFile	".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
475c73622aSBram Moolenaarsyn match   gitcommitUnmergedFile	".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
488c8de839SBram Moolenaarsyn match   gitcommitDiscardedArrow	" -> " contained nextgroup=gitcommitDiscardedFile
498c8de839SBram Moolenaarsyn match   gitcommitSelectedArrow	" -> " contained nextgroup=gitcommitSelectedFile
505c73622aSBram Moolenaarsyn match   gitcommitUnmergedArrow	" -> " contained nextgroup=gitcommitSelectedFile
515c73622aSBram Moolenaar
525c73622aSBram Moolenaarsyn match   gitcommitWarning		"\%^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl
535c73622aSBram Moolenaarsyn match   gitcommitWarning		"^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl contained
545c73622aSBram Moolenaarsyn match   gitcommitWarning		"^\%(no changes added to commit\|nothing \%(added \)\=to commit\)\>.*\%$"
558c8de839SBram Moolenaar
568c8de839SBram Moolenaarhi def link gitcommitSummary		Keyword
578c8de839SBram Moolenaarhi def link gitcommitComment		Comment
588c8de839SBram Moolenaarhi def link gitcommitUntracked		gitcommitComment
598c8de839SBram Moolenaarhi def link gitcommitDiscarded		gitcommitComment
608c8de839SBram Moolenaarhi def link gitcommitSelected		gitcommitComment
615c73622aSBram Moolenaarhi def link gitcommitUnmerged		gitcommitComment
628c8de839SBram Moolenaarhi def link gitcommitOnBranch		Comment
638c8de839SBram Moolenaarhi def link gitcommitBranch		Special
645c73622aSBram Moolenaarhi def link gitcommitNoBranch		gitCommitBranch
658c8de839SBram Moolenaarhi def link gitcommitDiscardedType	gitcommitType
668c8de839SBram Moolenaarhi def link gitcommitSelectedType	gitcommitType
675c73622aSBram Moolenaarhi def link gitcommitUnmergedType	gitcommitType
688c8de839SBram Moolenaarhi def link gitcommitType		Type
695c73622aSBram Moolenaarhi def link gitcommitNoChanges		gitcommitHeader
708c8de839SBram Moolenaarhi def link gitcommitHeader		PreProc
718c8de839SBram Moolenaarhi def link gitcommitUntrackedFile	gitcommitFile
728c8de839SBram Moolenaarhi def link gitcommitDiscardedFile	gitcommitFile
738c8de839SBram Moolenaarhi def link gitcommitSelectedFile	gitcommitFile
745c73622aSBram Moolenaarhi def link gitcommitUnmergedFile	gitcommitFile
758c8de839SBram Moolenaarhi def link gitcommitFile		Constant
768c8de839SBram Moolenaarhi def link gitcommitDiscardedArrow	gitcommitArrow
778c8de839SBram Moolenaarhi def link gitcommitSelectedArrow	gitcommitArrow
785c73622aSBram Moolenaarhi def link gitcommitUnmergedArrow	gitcommitArrow
798c8de839SBram Moolenaarhi def link gitcommitArrow		gitcommitComment
808c8de839SBram Moolenaar"hi def link gitcommitOverflow		Error
818c8de839SBram Moolenaarhi def link gitcommitBlank		Error
828c8de839SBram Moolenaar
838c8de839SBram Moolenaarlet b:current_syntax = "gitcommit"
84