debchangelog.vim 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. " Vim syntax file
  2. " Language: Debian changelog files
  3. " Maintainer: Debian Vim Maintainers
  4. " Former Maintainers: Gerfried Fuchs <alfie@ist.org>
  5. " Wichert Akkerman <wakkerma@debian.org>
  6. " Last Change: 2022 Mar 28
  7. " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debchangelog.vim
  8. " Standard syntax initialization
  9. if exists('b:current_syntax')
  10. finish
  11. endif
  12. " Case doesn't matter for us
  13. syn case ignore
  14. let s:urgency='urgency=\(low\|medium\|high\|emergency\|critical\)\( [^[:space:],][^,]*\)\='
  15. let s:binNMU='binary-only=yes'
  16. let s:cpo = &cpo
  17. set cpo-=C
  18. let s:supported = [
  19. \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental',
  20. \ 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm',
  21. \ 'trixie', 'sid', 'rc-buggy',
  22. \
  23. \ 'trusty', 'xenial', 'bionic', 'focal', 'impish', 'jammy',
  24. \ 'devel'
  25. \ ]
  26. let s:unsupported = [
  27. \ 'frozen', 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato',
  28. \ 'woody', 'sarge', 'etch', 'lenny', 'squeeze', 'wheezy',
  29. \
  30. \ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty',
  31. \ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid',
  32. \ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy',
  33. \ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty', 'artful', 'cosmic',
  34. \ 'disco', 'eoan', 'hirsute', 'groovy'
  35. \ ]
  36. let &cpo=s:cpo
  37. " Define some common expressions we can use later on
  38. syn match debchangelogName contained "^[[:alnum:]][[:alnum:].+-]\+ "
  39. exe 'syn match debchangelogFirstKV contained "; \('.s:urgency.'\|'.s:binNMU.'\)"'
  40. exe 'syn match debchangelogOtherKV contained ", \('.s:urgency.'\|'.s:binNMU.'\)"'
  41. exe 'syn match debchangelogTarget contained "\%( \%('.join(s:supported, '\|').'\)\>[-[:alnum:]]*\)\+"'
  42. exe 'syn match debchangelogUnsupportedTarget contained "\%( \%('.join(s:unsupported, '\|').'\)\>[-[:alnum:]]*\)\+"'
  43. syn match debchangelogUnreleased contained / UNRELEASED/
  44. syn match debchangelogVersion contained "(.\{-})"
  45. syn match debchangelogCloses contained "closes:\_s*\(bug\)\=#\=\_s\=\d\+\(,\_s*\(bug\)\=#\=\_s\=\d\+\)*"
  46. syn match debchangelogLP contained "\clp:\s\+#\d\+\(,\s*#\d\+\)*"
  47. syn match debchangelogEmail contained "[_=[:alnum:].+-]\+@[[:alnum:]./\-]\+"
  48. syn match debchangelogEmail contained "<.\{-}>"
  49. " Define the entries that make up the changelog
  50. syn region debchangelogHeader start="^[^ ]" end="$" contains=debchangelogName,debchangelogFirstKV,debchangelogOtherKV,debchangelogTarget,debchangelogUnsupportedTarget,debchangelogUnreleased,debchangelogVersion,debchangelogBinNMU oneline
  51. syn region debchangelogFooter start="^ [^ ]" end="$" contains=debchangelogEmail oneline
  52. syn region debchangelogEntry start="^ " end="$" contains=debchangelogCloses,debchangelogLP oneline
  53. " Associate our matches and regions with pretty colours
  54. hi def link debchangelogHeader Error
  55. hi def link debchangelogFooter Identifier
  56. hi def link debchangelogEntry Normal
  57. hi def link debchangelogCloses Statement
  58. hi def link debchangelogLP Statement
  59. hi def link debchangelogFirstKV Identifier
  60. hi def link debchangelogOtherKV Identifier
  61. hi def link debchangelogName Comment
  62. hi def link debchangelogVersion Identifier
  63. hi def link debchangelogTarget Identifier
  64. hi def link debchangelogUnsupportedTarget Identifier
  65. hi def link debchangelogUnreleased WarningMsg
  66. hi def link debchangelogEmail Special
  67. let b:current_syntax = 'debchangelog'
  68. " vim: ts=8 sw=2