xref: /vim-8.2.3635/runtime/syntax/gitcommit.vim (revision 5c73622a)
18c8de839SBram Moolenaar" Vim syntax file
28c8de839SBram Moolenaar" Language:	git commit file
3*5c73622aSBram Moolenaar" Maintainer:	Tim Pope <[email protected]>
48c8de839SBram Moolenaar" Filenames:	*.git/COMMIT_EDITMSG
5*5c73622aSBram Moolenaar" Last Change:	2009 Dec 24
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*5c73622aSBram Moolenaarsyn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^$\|^#\@=/ 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	"^#.*"
26*5c73622aSBram Moolenaarsyn match   gitcommitHead	"^\%(#   .*\n\)\+#$" contained transparent
278c8de839SBram Moolenaarsyn match   gitcommitOnBranch	"\%(^# \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
28*5c73622aSBram Moolenaarsyn match   gitcommitOnBranch	"\%(^# \)\@<=Your branch .\{-\} '" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
29*5c73622aSBram Moolenaarsyn match   gitcommitBranch	"[^ \t']\+" contained
30*5c73622aSBram Moolenaarsyn match   gitcommitNoBranch	"\%(^# \)\@<=Not currently on any branch." contained containedin=gitcommitComment
318c8de839SBram Moolenaarsyn match   gitcommitHeader	"\%(^# \)\@<=.*:$"	contained containedin=gitcommitComment
32*5c73622aSBram Moolenaarsyn region  gitcommitAuthor	matchgroup=gitCommitHeader start=/\%(^# \)\@<=Author:/ end=/$/ keepend oneline contained containedin=gitcommitComment transparent
33*5c73622aSBram 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
388c8de839SBram Moolenaarsyn region  gitcommitDiscarded	start=/^# Changed but not updated:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitDiscardedType fold
398c8de839SBram Moolenaarsyn region  gitcommitSelected	start=/^# Changes to be committed:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold
40*5c73622aSBram 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
44*5c73622aSBram 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
47*5c73622aSBram Moolenaarsyn match   gitcommitUnmergedFile	".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
488c8de839SBram Moolenaarsyn match   gitcommitDiscardedArrow	" -> " contained nextgroup=gitcommitDiscardedFile
498c8de839SBram Moolenaarsyn match   gitcommitSelectedArrow	" -> " contained nextgroup=gitcommitSelectedFile
50*5c73622aSBram Moolenaarsyn match   gitcommitUnmergedArrow	" -> " contained nextgroup=gitcommitSelectedFile
51*5c73622aSBram Moolenaar
52*5c73622aSBram Moolenaarsyn match   gitcommitWarning		"\%^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl
53*5c73622aSBram Moolenaarsyn match   gitcommitWarning		"^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl contained
54*5c73622aSBram 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
61*5c73622aSBram Moolenaarhi def link gitcommitUnmerged		gitcommitComment
628c8de839SBram Moolenaarhi def link gitcommitOnBranch		Comment
638c8de839SBram Moolenaarhi def link gitcommitBranch		Special
64*5c73622aSBram Moolenaarhi def link gitcommitNoBranch		gitCommitBranch
658c8de839SBram Moolenaarhi def link gitcommitDiscardedType	gitcommitType
668c8de839SBram Moolenaarhi def link gitcommitSelectedType	gitcommitType
67*5c73622aSBram Moolenaarhi def link gitcommitUnmergedType	gitcommitType
688c8de839SBram Moolenaarhi def link gitcommitType		Type
69*5c73622aSBram 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
74*5c73622aSBram Moolenaarhi def link gitcommitUnmergedFile	gitcommitFile
758c8de839SBram Moolenaarhi def link gitcommitFile		Constant
768c8de839SBram Moolenaarhi def link gitcommitDiscardedArrow	gitcommitArrow
778c8de839SBram Moolenaarhi def link gitcommitSelectedArrow	gitcommitArrow
78*5c73622aSBram 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