xref: /vim-8.2.3635/runtime/syntax/gitcommit.vim (revision c08ee747)
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*c08ee747SBram Moolenaar" Last Change:	2019 Dec 05
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
1953bfca22SBram Moolenaarsyn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|#\)\@=/ fold contains=@gitcommitDiff
208c8de839SBram Moolenaar
21*c08ee747SBram Moolenaarsyn match   gitcommitSummary	"^.*\%<51v." contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
228c8de839SBram Moolenaarsyn match   gitcommitOverflow	".*" contained contains=@Spell
238c8de839SBram Moolenaarsyn match   gitcommitBlank	"^[^#].*" contained contains=@Spell
24*c08ee747SBram Moolenaar
25*c08ee747SBram Moolenaarif get(g:, "gitcommit_cleanup") is# "scissors"
26*c08ee747SBram Moolenaar  syn match gitcommitFirstLine	"\%^.*" nextgroup=gitcommitBlank skipnl
27*c08ee747SBram Moolenaar  syn region gitcommitComment start=/^# -\+ >8 -\+$/ end=/\%$/ contains=gitcommitDiff
28*c08ee747SBram Moolenaarelse
29*c08ee747SBram Moolenaar  syn match gitcommitFirstLine	"\%^[^#].*" nextgroup=gitcommitBlank skipnl
308c8de839SBram Moolenaar  syn match gitcommitComment	"^#.*"
31*c08ee747SBram Moolenaarendif
32*c08ee747SBram Moolenaar
335c73622aSBram Moolenaarsyn match   gitcommitHead	"^\%(#   .*\n\)\+#$" contained transparent
348c8de839SBram Moolenaarsyn match   gitcommitOnBranch	"\%(^# \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
355c73622aSBram Moolenaarsyn match   gitcommitOnBranch	"\%(^# \)\@<=Your branch .\{-\} '" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
3653bfca22SBram Moolenaarsyn match   gitcommitBranch	"[^ ']\+" contained
375c73622aSBram Moolenaarsyn match   gitcommitNoBranch	"\%(^# \)\@<=Not currently on any branch." contained containedin=gitcommitComment
388c8de839SBram Moolenaarsyn match   gitcommitHeader	"\%(^# \)\@<=.*:$"	contained containedin=gitcommitComment
397a329911SBram Moolenaarsyn region  gitcommitAuthor	matchgroup=gitCommitHeader start=/\%(^# \)\@<=\%(Author\|Committer\):/ end=/$/ keepend oneline contained containedin=gitcommitComment transparent
405c73622aSBram Moolenaarsyn match   gitcommitNoChanges	"\%(^# \)\@<=No changes$" contained containedin=gitcommitComment
418c8de839SBram Moolenaar
428c8de839SBram Moolenaarsyn region  gitcommitUntracked	start=/^# Untracked files:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUntrackedFile fold
438c8de839SBram Moolenaarsyn match   gitcommitUntrackedFile  "\t\@<=.*"	contained
448c8de839SBram Moolenaar
4553bfca22SBram Moolenaarsyn region  gitcommitDiscarded	start=/^# Change\%(s not staged for commit\|d but not updated\):/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitDiscardedType fold
468c8de839SBram Moolenaarsyn region  gitcommitSelected	start=/^# Changes to be committed:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold
475c73622aSBram Moolenaarsyn region  gitcommitUnmerged	start=/^# Unmerged paths:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUnmergedType fold
488c8de839SBram Moolenaar
4989bcfda6SBram Moolenaar
5089bcfda6SBram Moolenaarsyn match   gitcommitDiscardedType	"\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2	contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite
5189bcfda6SBram Moolenaarsyn match   gitcommitSelectedType	"\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2	contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite
5289bcfda6SBram Moolenaarsyn match   gitcommitUnmergedType	"\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2	contained containedin=gitcommitComment nextgroup=gitcommitUnmergedFile skipwhite
538c8de839SBram Moolenaarsyn match   gitcommitDiscardedFile	".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow
548c8de839SBram Moolenaarsyn match   gitcommitSelectedFile	".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
555c73622aSBram Moolenaarsyn match   gitcommitUnmergedFile	".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
568c8de839SBram Moolenaarsyn match   gitcommitDiscardedArrow	" -> " contained nextgroup=gitcommitDiscardedFile
578c8de839SBram Moolenaarsyn match   gitcommitSelectedArrow	" -> " contained nextgroup=gitcommitSelectedFile
585c73622aSBram Moolenaarsyn match   gitcommitUnmergedArrow	" -> " contained nextgroup=gitcommitSelectedFile
595c73622aSBram Moolenaar
605c73622aSBram Moolenaarsyn match   gitcommitWarning		"\%^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl
615c73622aSBram Moolenaarsyn match   gitcommitWarning		"^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl contained
625c73622aSBram Moolenaarsyn match   gitcommitWarning		"^\%(no changes added to commit\|nothing \%(added \)\=to commit\)\>.*\%$"
638c8de839SBram Moolenaar
648c8de839SBram Moolenaarhi def link gitcommitSummary		Keyword
658c8de839SBram Moolenaarhi def link gitcommitComment		Comment
668c8de839SBram Moolenaarhi def link gitcommitUntracked		gitcommitComment
678c8de839SBram Moolenaarhi def link gitcommitDiscarded		gitcommitComment
688c8de839SBram Moolenaarhi def link gitcommitSelected		gitcommitComment
695c73622aSBram Moolenaarhi def link gitcommitUnmerged		gitcommitComment
708c8de839SBram Moolenaarhi def link gitcommitOnBranch		Comment
718c8de839SBram Moolenaarhi def link gitcommitBranch		Special
725c73622aSBram Moolenaarhi def link gitcommitNoBranch		gitCommitBranch
738c8de839SBram Moolenaarhi def link gitcommitDiscardedType	gitcommitType
748c8de839SBram Moolenaarhi def link gitcommitSelectedType	gitcommitType
755c73622aSBram Moolenaarhi def link gitcommitUnmergedType	gitcommitType
768c8de839SBram Moolenaarhi def link gitcommitType		Type
775c73622aSBram Moolenaarhi def link gitcommitNoChanges		gitcommitHeader
788c8de839SBram Moolenaarhi def link gitcommitHeader		PreProc
798c8de839SBram Moolenaarhi def link gitcommitUntrackedFile	gitcommitFile
808c8de839SBram Moolenaarhi def link gitcommitDiscardedFile	gitcommitFile
818c8de839SBram Moolenaarhi def link gitcommitSelectedFile	gitcommitFile
825c73622aSBram Moolenaarhi def link gitcommitUnmergedFile	gitcommitFile
838c8de839SBram Moolenaarhi def link gitcommitFile		Constant
848c8de839SBram Moolenaarhi def link gitcommitDiscardedArrow	gitcommitArrow
858c8de839SBram Moolenaarhi def link gitcommitSelectedArrow	gitcommitArrow
865c73622aSBram Moolenaarhi def link gitcommitUnmergedArrow	gitcommitArrow
878c8de839SBram Moolenaarhi def link gitcommitArrow		gitcommitComment
888c8de839SBram Moolenaar"hi def link gitcommitOverflow		Error
898c8de839SBram Moolenaarhi def link gitcommitBlank		Error
908c8de839SBram Moolenaar
918c8de839SBram Moolenaarlet b:current_syntax = "gitcommit"
92