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