vimrc/sources_non_forked/vim-fugitive/syntax/fugitive.vim

58 lines
3 KiB
VimL
Raw Normal View History

2019-01-08 10:11:54 +00:00
if exists("b:current_syntax")
finish
endif
syn sync fromstart
syn spell notoplevel
syn include @fugitiveDiff syntax/diff.vim
2021-07-30 20:52:54 +00:00
syn match fugitiveHeader /^[A-Z][a-z][^:]*:/
syn match fugitiveHeader /^Head:/ nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite
syn match fugitiveHeader /^Pull:\|^Rebase:\|^Merge:\|^Push:/ nextgroup=fugitiveSymbolicRef skipwhite
2020-06-21 15:50:44 +00:00
syn match fugitiveHelpHeader /^Help:/ nextgroup=fugitiveHelpTag skipwhite
syn match fugitiveHelpTag /\S\+/ contained
2019-01-08 10:11:54 +00:00
2023-04-01 20:48:04 +00:00
syn region fugitiveSection start=/^\%(.*(\d\++\=)$\)\@=/ contains=fugitiveHeading end=/^$/ fold
2019-08-22 15:36:17 +00:00
syn cluster fugitiveSection contains=fugitiveSection
2021-10-11 09:30:43 +00:00
syn match fugitiveHeading /^[A-Z][a-z][^:]*\ze (\d\++\=)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite
syn match fugitiveCount /(\d\++\=)/hs=s+1,he=e-1 contained
2019-01-08 10:11:54 +00:00
syn match fugitivePreposition /\<\%([io]nto\|from\|to\|Rebasing\%( detached\)\=\)\>/ transparent contained nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite
2019-08-22 15:36:17 +00:00
syn match fugitiveInstruction /^\l\l\+\>/ contained containedin=@fugitiveSection nextgroup=fugitiveHash skipwhite
syn match fugitiveDone /^done\>/ contained containedin=@fugitiveSection nextgroup=fugitiveHash skipwhite
syn match fugitiveStop /^stop\>/ contained containedin=@fugitiveSection nextgroup=fugitiveHash skipwhite
syn match fugitiveModifier /^[MADRCU?]\{1,2} / contained containedin=@fugitiveSection
syn match fugitiveSymbolicRef /\.\@!\%(\.\.\@!\|[^[:space:][:cntrl:]\:.]\)\+\.\@<!/ contained
2020-06-21 15:50:44 +00:00
syn match fugitiveHash /^\x\{4,\}\S\@!/ contained containedin=@fugitiveSection
syn match fugitiveHash /\S\@<!\x\{4,\}\S\@!/ contained
2019-01-08 10:11:54 +00:00
2021-05-31 20:30:26 +00:00
syn region fugitiveHunk start=/^\%(@@\+ -\)\@=/ end=/^\%([A-Za-z?@]\|$\)\@=/ contains=diffLine,diffRemoved,diffAdded,diffNoEOL containedin=@fugitiveSection fold
2019-08-22 15:36:17 +00:00
for s:section in ['Untracked', 'Unstaged', 'Staged']
2023-04-01 20:48:04 +00:00
exe 'syn region fugitive' . s:section . 'Section start=/^\%(' . s:section . ' .*(\d\++\=)$\)\@=/ contains=fugitive' . s:section . 'Heading end=/^$/ fold'
2019-08-22 15:36:17 +00:00
exe 'syn match fugitive' . s:section . 'Modifier /^[MADRCU?] / contained containedin=fugitive' . s:section . 'Section'
exe 'syn cluster fugitiveSection add=fugitive' . s:section . 'Section'
2021-10-11 09:30:43 +00:00
exe 'syn match fugitive' . s:section . 'Heading /^[A-Z][a-z][^:]*\ze (\d\++\=)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite'
2019-08-22 15:36:17 +00:00
endfor
unlet s:section
2019-01-08 10:11:54 +00:00
2020-06-21 15:50:44 +00:00
hi def link fugitiveHelpHeader fugitiveHeader
2019-01-08 10:11:54 +00:00
hi def link fugitiveHeader Label
2020-06-21 15:50:44 +00:00
hi def link fugitiveHelpTag Tag
2019-01-08 10:11:54 +00:00
hi def link fugitiveHeading PreProc
2019-08-22 15:36:17 +00:00
hi def link fugitiveUntrackedHeading PreCondit
hi def link fugitiveUnstagedHeading Macro
hi def link fugitiveStagedHeading Include
2019-01-08 10:11:54 +00:00
hi def link fugitiveModifier Type
2019-08-22 15:36:17 +00:00
hi def link fugitiveUntrackedModifier StorageClass
hi def link fugitiveUnstagedModifier Structure
hi def link fugitiveStagedModifier Typedef
2019-01-08 10:11:54 +00:00
hi def link fugitiveInstruction Type
hi def link fugitiveStop Function
hi def link fugitiveHash Identifier
hi def link fugitiveSymbolicRef Function
hi def link fugitiveCount Number
let b:current_syntax = "fugitive"