blob: e75d044178dffb294934067d79c33984affa0fbd [file] [log] [blame]
Bram Moolenaar8c8de832008-06-24 22:58:06 +00001" Vim syntax file
2" Language: git commit file
3" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
4" Filenames: *.git/COMMIT_EDITMSG
5" Last Change: 2008 Apr 09
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 \)\@=/ end=/^$\|^#\@=/ 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 region gitcommitHead start=/^# / end=/^#$/ contained transparent
27syn match gitcommitOnBranch "\%(^# \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
28syn match gitcommitBranch "\S\+" contained
29syn match gitcommitHeader "\%(^# \)\@<=.*:$" contained containedin=gitcommitComment
30
31syn region gitcommitUntracked start=/^# Untracked files:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUntrackedFile fold
32syn match gitcommitUntrackedFile "\t\@<=.*" contained
33
34syn region gitcommitDiscarded start=/^# Changed but not updated:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitDiscardedType fold
35syn region gitcommitSelected start=/^# Changes to be committed:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold
36
37syn match gitcommitDiscardedType "\t\@<=[a-z][a-z ]*[a-z]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite
38syn match gitcommitSelectedType "\t\@<=[a-z][a-z ]*[a-z]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite
39syn match gitcommitDiscardedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow
40syn match gitcommitSelectedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
41syn match gitcommitDiscardedArrow " -> " contained nextgroup=gitcommitDiscardedFile
42syn match gitcommitSelectedArrow " -> " contained nextgroup=gitcommitSelectedFile
43
44hi def link gitcommitSummary Keyword
45hi def link gitcommitComment Comment
46hi def link gitcommitUntracked gitcommitComment
47hi def link gitcommitDiscarded gitcommitComment
48hi def link gitcommitSelected gitcommitComment
49hi def link gitcommitOnBranch Comment
50hi def link gitcommitBranch Special
51hi def link gitcommitDiscardedType gitcommitType
52hi def link gitcommitSelectedType gitcommitType
53hi def link gitcommitType Type
54hi def link gitcommitHeader PreProc
55hi def link gitcommitUntrackedFile gitcommitFile
56hi def link gitcommitDiscardedFile gitcommitFile
57hi def link gitcommitSelectedFile gitcommitFile
58hi def link gitcommitFile Constant
59hi def link gitcommitDiscardedArrow gitcommitArrow
60hi def link gitcommitSelectedArrow gitcommitArrow
61hi def link gitcommitArrow gitcommitComment
62"hi def link gitcommitOverflow Error
63hi def link gitcommitBlank Error
64
65let b:current_syntax = "gitcommit"