xref: /vim-8.2.3635/runtime/syntax/gitcommit.vim (revision 89bcfda6)
1" Vim syntax file
2" Language:	git commit file
3" Maintainer:	Tim Pope <[email protected]>
4" Filenames:	*.git/COMMIT_EDITMSG
5" Last Change:	2016 Aug 29
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   gitcommitFirstLine	"\%^[^#].*"  nextgroup=gitcommitBlank skipnl
22syn match   gitcommitSummary	"^.\{0,50\}" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
23syn match   gitcommitOverflow	".*" contained contains=@Spell
24syn match   gitcommitBlank	"^[^#].*" contained contains=@Spell
25syn match   gitcommitComment	"^#.*"
26syn match   gitcommitHead	"^\%(#   .*\n\)\+#$" contained transparent
27syn match   gitcommitOnBranch	"\%(^# \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
28syn match   gitcommitOnBranch	"\%(^# \)\@<=Your branch .\{-\} '" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
29syn match   gitcommitBranch	"[^ ']\+" contained
30syn match   gitcommitNoBranch	"\%(^# \)\@<=Not currently on any branch." contained containedin=gitcommitComment
31syn match   gitcommitHeader	"\%(^# \)\@<=.*:$"	contained containedin=gitcommitComment
32syn region  gitcommitAuthor	matchgroup=gitCommitHeader start=/\%(^# \)\@<=\%(Author\|Committer\):/ end=/$/ keepend oneline contained containedin=gitcommitComment transparent
33syn match   gitcommitNoChanges	"\%(^# \)\@<=No changes$" contained containedin=gitcommitComment
34
35syn region  gitcommitUntracked	start=/^# Untracked files:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUntrackedFile fold
36syn match   gitcommitUntrackedFile  "\t\@<=.*"	contained
37
38syn region  gitcommitDiscarded	start=/^# Change\%(s not staged for commit\|d but not updated\):/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitDiscardedType fold
39syn region  gitcommitSelected	start=/^# Changes to be committed:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold
40syn region  gitcommitUnmerged	start=/^# Unmerged paths:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUnmergedType fold
41
42
43syn match   gitcommitDiscardedType	"\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2	contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite
44syn match   gitcommitSelectedType	"\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2	contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite
45syn match   gitcommitUnmergedType	"\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2	contained containedin=gitcommitComment nextgroup=gitcommitUnmergedFile skipwhite
46syn match   gitcommitDiscardedFile	".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow
47syn match   gitcommitSelectedFile	".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
48syn match   gitcommitUnmergedFile	".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
49syn match   gitcommitDiscardedArrow	" -> " contained nextgroup=gitcommitDiscardedFile
50syn match   gitcommitSelectedArrow	" -> " contained nextgroup=gitcommitSelectedFile
51syn match   gitcommitUnmergedArrow	" -> " contained nextgroup=gitcommitSelectedFile
52
53syn match   gitcommitWarning		"\%^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl
54syn match   gitcommitWarning		"^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl contained
55syn match   gitcommitWarning		"^\%(no changes added to commit\|nothing \%(added \)\=to commit\)\>.*\%$"
56
57hi def link gitcommitSummary		Keyword
58hi def link gitcommitComment		Comment
59hi def link gitcommitUntracked		gitcommitComment
60hi def link gitcommitDiscarded		gitcommitComment
61hi def link gitcommitSelected		gitcommitComment
62hi def link gitcommitUnmerged		gitcommitComment
63hi def link gitcommitOnBranch		Comment
64hi def link gitcommitBranch		Special
65hi def link gitcommitNoBranch		gitCommitBranch
66hi def link gitcommitDiscardedType	gitcommitType
67hi def link gitcommitSelectedType	gitcommitType
68hi def link gitcommitUnmergedType	gitcommitType
69hi def link gitcommitType		Type
70hi def link gitcommitNoChanges		gitcommitHeader
71hi def link gitcommitHeader		PreProc
72hi def link gitcommitUntrackedFile	gitcommitFile
73hi def link gitcommitDiscardedFile	gitcommitFile
74hi def link gitcommitSelectedFile	gitcommitFile
75hi def link gitcommitUnmergedFile	gitcommitFile
76hi def link gitcommitFile		Constant
77hi def link gitcommitDiscardedArrow	gitcommitArrow
78hi def link gitcommitSelectedArrow	gitcommitArrow
79hi def link gitcommitUnmergedArrow	gitcommitArrow
80hi def link gitcommitArrow		gitcommitComment
81"hi def link gitcommitOverflow		Error
82hi def link gitcommitBlank		Error
83
84let b:current_syntax = "gitcommit"
85