home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / runtime / syntax / gitcommit.vim < prev    next >
Encoding:
Text File  |  2012-05-31  |  4.7 KB  |  84 lines

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