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