debsources.vim 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. " Vim syntax file
  2. " Language: Debian sources.list
  3. " Maintainer: Debian Vim Maintainers
  4. " Former Maintainer: Matthijs Mohlmann <matthijs@cacholong.nl>
  5. " Last Change: 2022 Oct 29
  6. " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debsources.vim
  7. " Standard syntax initialization
  8. if exists('b:current_syntax')
  9. finish
  10. endif
  11. " case sensitive
  12. syn case match
  13. " A bunch of useful keywords
  14. syn match debsourcesKeyword /\(deb-src\|deb\|main\|contrib\|non-free\|restricted\|universe\|multiverse\)/
  15. " Match comments
  16. syn match debsourcesComment /#.*/ contains=@Spell
  17. let s:cpo = &cpo
  18. set cpo-=C
  19. let s:supported = [
  20. \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', 'sid', 'rc-buggy',
  21. \ 'buster', 'bullseye', 'bookworm', 'trixie', 'forky',
  22. \
  23. \ 'trusty', 'xenial', 'bionic', 'focal', 'jammy', 'kinetic', 'lunar',
  24. \ 'devel'
  25. \ ]
  26. let s:unsupported = [
  27. \ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato',
  28. \ 'woody', 'sarge', 'etch', 'lenny', 'squeeze', 'wheezy',
  29. \ 'jessie', 'stretch',
  30. \
  31. \ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty',
  32. \ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid',
  33. \ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy',
  34. \ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty', 'artful', 'cosmic',
  35. \ 'disco', 'eoan', 'hirsute', 'impish', 'groovy'
  36. \ ]
  37. let &cpo=s:cpo
  38. " Match uri's
  39. syn match debsourcesUri '\(https\?://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' <>"]\+'
  40. exe 'syn match debsourcesDistrKeyword +\([[:alnum:]_./]*\)\<\('. join(s:supported, '\|'). '\)\>\([-[:alnum:]_./]*\)+'
  41. exe 'syn match debsourcesUnsupportedDistrKeyword +\([[:alnum:]_./]*\)\<\('. join(s:unsupported, '\|') .'\)\>\([-[:alnum:]_./]*\)+'
  42. " Associate our matches and regions with pretty colours
  43. hi def link debsourcesLine Error
  44. hi def link debsourcesKeyword Statement
  45. hi def link debsourcesDistrKeyword Type
  46. hi def link debsourcesUnsupportedDistrKeyword WarningMsg
  47. hi def link debsourcesComment Comment
  48. hi def link debsourcesUri Constant
  49. let b:current_syntax = 'debsources'