-
Notifications
You must be signed in to change notification settings - Fork 32
/
gitmessengerpopup.vim
50 lines (44 loc) · 2.13 KB
/
gitmessengerpopup.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
if exists('b:current_syntax')
finish
endif
syn match gitmessengerHeader '^ \=\%(History\|Commit\|\%(Author \|Committer \)\=Date\|Author\|Committer\):' display
syn match gitmessengerHash '\%(^ \=Commit: \+\)\@<=[[:xdigit:]]\+' display
syn match gitmessengerHistory '\%(^ \=History: \+\)\@<=#\d\+' display
syn match gitmessengerEmail '\%(^ \=\%(Author\|Committer\): \+.*\)\@<=<.\+>' display
" Diff included in popup
" There are two types of diff format; 'none' 'current', 'all', 'current.word', 'all.word'.
" 'current.word' and 'all.word' are for word diff. And 'current' and 'all' are " for unified diff.
" Define different highlights for unified diffs and word diffs.
" b:__gitmessenger_diff is set by Blame.render() in blame.vim.
if get(b:, '__gitmessenger_diff', '') =~# '\.word$'
if has('conceal') && get(g:, 'git_messenger_conceal_word_diff_marker', v:true)
syn region diffWordsRemoved matchgroup=Conceal start=/\[-/ end=/-]/ concealends oneline
syn region diffWordsAdded matchgroup=Conceal start=/{+/ end=/+}/ concealends oneline
else
syn region diffWordsRemoved start=/\[-/ end=/-]/ oneline
syn region diffWordsAdded start=/{+/ end=/+}/ oneline
endif
else
syn match diffRemoved "^ \=-.*" display
syn match diffAdded "^ \=+.*" display
endif
syn match diffFile "^ \=diff --git .*" display
syn match diffOldFile "^ \=--- a\>.*" display
syn match diffNewFile "^ \=+++ b\>.*" display
syn match diffIndexLine "^ \=index \x\{7,}\.\.\x\{7,}.*" display
syn match diffLine "^ \=@@ .*" display
hi def link gitmessengerHeader Identifier
hi def link gitmessengerHash Comment
hi def link gitmessengerHistory Constant
hi def link gitmessengerEmail gitmessengerPopupNormal
hi def link gitmessengerPopupNormal NormalFloat
hi def link diffOldFile diffFile
hi def link diffNewFile diffFile
hi def link diffIndexLine PreProc
hi def link diffFile Type
hi def link diffRemoved Special
hi def link diffAdded Identifier
hi def link diffWordsRemoved diffRemoved
hi def link diffWordsAdded diffAdded
hi def link diffLine Statement
let b:current_syntax = 'gitmessengerpopup'