fugitive.vim 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. if exists("b:current_syntax")
  2. finish
  3. endif
  4. syn sync fromstart
  5. syn spell notoplevel
  6. syn include @fugitiveDiff syntax/diff.vim
  7. syn match fugitiveHeader /^[A-Z][a-z][^:]*:/
  8. syn match fugitiveHeader /^Head:/ nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite
  9. syn match fugitiveHeader /^Pull:\|^Rebase:\|^Merge:\|^Push:/ nextgroup=fugitiveSymbolicRef skipwhite
  10. syn match fugitiveHelpHeader /^Help:/ nextgroup=fugitiveHelpTag skipwhite
  11. syn match fugitiveHelpTag /\S\+/ contained
  12. syn region fugitiveSection start=/^\%(.*(\d\++\=)$\)\@=/ contains=fugitiveHeading end=/^$/
  13. syn cluster fugitiveSection contains=fugitiveSection
  14. syn match fugitiveHeading /^[A-Z][a-z][^:]*\ze (\d\++\=)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite
  15. syn match fugitiveCount /(\d\++\=)/hs=s+1,he=e-1 contained
  16. syn match fugitivePreposition /\<\%([io]nto\|from\|to\|Rebasing\%( detached\)\=\)\>/ transparent contained nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite
  17. syn match fugitiveInstruction /^\l\l\+\>/ contained containedin=@fugitiveSection nextgroup=fugitiveHash skipwhite
  18. syn match fugitiveDone /^done\>/ contained containedin=@fugitiveSection nextgroup=fugitiveHash skipwhite
  19. syn match fugitiveStop /^stop\>/ contained containedin=@fugitiveSection nextgroup=fugitiveHash skipwhite
  20. syn match fugitiveModifier /^[MADRCU?]\{1,2} / contained containedin=@fugitiveSection
  21. syn match fugitiveSymbolicRef /\.\@!\%(\.\.\@!\|[^[:space:][:cntrl:]\:.]\)\+\.\@<!/ contained
  22. syn match fugitiveHash /^\x\{4,\}\S\@!/ contained containedin=@fugitiveSection
  23. syn match fugitiveHash /\S\@<!\x\{4,\}\S\@!/ contained
  24. syn region fugitiveHunk start=/^\%(@@\+ -\)\@=/ end=/^\%([A-Za-z?@]\|$\)\@=/ contains=diffLine,diffRemoved,diffAdded,diffNoEOL containedin=@fugitiveSection fold
  25. for s:section in ['Untracked', 'Unstaged', 'Staged']
  26. exe 'syn region fugitive' . s:section . 'Section start=/^\%(' . s:section . ' .*(\d\++\=)$\)\@=/ contains=fugitive' . s:section . 'Heading end=/^$/'
  27. exe 'syn match fugitive' . s:section . 'Modifier /^[MADRCU?] / contained containedin=fugitive' . s:section . 'Section'
  28. exe 'syn cluster fugitiveSection add=fugitive' . s:section . 'Section'
  29. exe 'syn match fugitive' . s:section . 'Heading /^[A-Z][a-z][^:]*\ze (\d\++\=)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite'
  30. endfor
  31. unlet s:section
  32. hi def link fugitiveHelpHeader fugitiveHeader
  33. hi def link fugitiveHeader Label
  34. hi def link fugitiveHelpTag Tag
  35. hi def link fugitiveHeading PreProc
  36. hi def link fugitiveUntrackedHeading PreCondit
  37. hi def link fugitiveUnstagedHeading Macro
  38. hi def link fugitiveStagedHeading Include
  39. hi def link fugitiveModifier Type
  40. hi def link fugitiveUntrackedModifier StorageClass
  41. hi def link fugitiveUnstagedModifier Structure
  42. hi def link fugitiveStagedModifier Typedef
  43. hi def link fugitiveInstruction Type
  44. hi def link fugitiveStop Function
  45. hi def link fugitiveHash Identifier
  46. hi def link fugitiveSymbolicRef Function
  47. hi def link fugitiveCount Number
  48. let b:current_syntax = "fugitive"