contrib/vim: Add vim syntax highlighting for StGit commit messages
[stgit] / contrib / vim / syntax / stgedit.vim
1 " Vim syntax file
2 " Language: StGit 'stg edit' commit message file
3 " Author: Zane Bitter <zane.bitter@alliedtelesis.co.nz>
4
5 if exists("b:current_syntax")
6 finish
7 endif
8
9
10 runtime! syntax/mail.vim
11 unlet b:current_syntax
12
13 syn include @stgDiff syntax/diff.vim
14
15
16 syn case match
17 syn sync minlines=50
18
19
20 if has("spell")
21 syn spell toplevel
22 endif
23
24
25 syn match stgeditFrom "\%^From:.*" contains=mailHeader nextgroup=stgeditFirstLine skipempty
26 syn match stgeditFirstLine "^.\+" contained nextgroup=stgeditDiffs,stgeditComment,stgeditBlank skipnl
27 syn match stgeditSummary "^.\{0,50\}" contained containedin=stgeditFirstLine nextgroup=stgeditOverflow contains=@Spell
28 syn match stgeditOverflow ".*" contained contains=@Spell
29 syn match stgeditBlank "^.\+" contained contains=@Spell
30 syn match stgeditComment "^#.*"
31 syn region stgeditDiffs start="^---" end="%$" contains=@stgDiff fold
32 syn region stgeditDiff start="^\%(diff --git \)\@=" end="^\%(diff --git \|$\)\@=" contained containedin=stgeditDiffs contains=@stgDiff fold
33
34 hi def link stgeditSummary Keyword
35 hi def link stgeditComment Comment
36 hi def link stgeditBlank Error
37
38
39 let b:current_syntax = "stgedit"