1" Vim syntax file
2" Language: Debian control files
3" Maintainer: Debian Vim Maintainers
4" Former Maintainers: Gerfried Fuchs <alfie@ist.org>
5" Wichert Akkerman <wakkerma@debian.org>
6" Last Change: 2026 Jan 20
7" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/debcontrol.vim
8
9" Standard syntax initialization
10if exists('b:current_syntax')
11 finish
12endif
…lines 13–30 unchanged (18 lines)
31" Define some common expressions we can use later on
32syn keyword debcontrolArchitecture contained all any
33exe 'syn keyword debcontrolArchitecture contained '. join(g:debArchitectureKernelAnyArch)
34exe 'syn keyword debcontrolArchitecture contained '. join(g:debArchitectureAnyKernelArch)
35exe 'syn keyword debcontrolArchitecture contained '. join(g:debArchitectureArchs)
36
37" Keep in sync with https://metadata.ftp-master.debian.org/sections.822
38" curl -q https://metadata.ftp-master.debian.org/sections.822 2>/dev/null| grep-dctrl -n --not -FSection -sSection / -
39let s:sections = [
40 \ 'admin', 'cli-mono', 'comm', 'database', 'debian-installer', 'debug'
41 \, 'devel', 'doc', 'editors', 'education', 'electronics', 'embedded'
42 \, 'fonts', 'games', 'gnome', 'gnu-r', 'gnustep', 'golang', 'graphics'
43 \, 'hamradio', 'haskell', 'httpd', 'interpreters', 'introspection'
…lines 44–70 unchanged (27 lines)
71syn match debcontrolEmail "[_=[:alnum:]\.+-]\+@[[:alnum:]\./\-]\+"
72syn match debcontrolEmail "<.\{-}>"
73
74" #-Comments
75syn match debcontrolComment "^#.*$" contains=@Spell
76
77" Build profiles
78" Since there's no official spec for the field, use dpkg's parsing
79" (from BuildProfiles.pm) as the de facto spec
80syn match debcontrolBuildProfile "<\@<!<\s*!\=[-?/;:=@%*~A-Za-z0-9+.]\+\%(\s\+!\=[-?/;:=@%*~A-Za-z0-9+.]\+\)*\s*>" contained
81
82" Architecture specification for a package relationship
83let s:all_archs = join(g:debArchitectureKernelAnyArch, '\|')
84 \. '\|'
85 \. join(g:debArchitectureAnyKernelArch, '\|')
86 \. '\|'
87 \. join(g:debArchitectureArchs, '\|')
88exe 'syn match debcontrolArchSpec "\[\s*!\=\%('. s:all_archs .'\)\%(\s\+!\=\%('. s:all_archs. '\)\)*\s*\]" contained'
89unlet s:all_archs
90
91syn case ignore
92
93" Handle all fields from deb-src-control(5)
94
95" Catch-all for the legal fields
…lines 96–110 unchanged (15 lines)
111syn region debcontrolStrictField matchgroup=debcontrolKey start="^Homepage: *" end="$" contains=debcontrolHTTPUrl oneline keepend
112syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-[-a-zA-Z0-9]\+-\)\=Vcs-\%(Browser\|Arch\|Bzr\|Darcs\|Hg\): *" end="$" contains=debcontrolHTTPUrl oneline keepend
113syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-[-a-zA-Z0-9]\+-\)\=Vcs-Svn: *" end="$" contains=debcontrolVcsSvn,debcontrolHTTPUrl oneline keepend
114syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-[-a-zA-Z0-9]\+-\)\=Vcs-Cvs: *" end="$" contains=debcontrolVcsCvs oneline keepend
115syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-[-a-zA-Z0-9]\+-\)\=Vcs-Git: *" end="$" contains=debcontrolVcsGit oneline keepend
116syn region debcontrolStrictField matchgroup=debcontrolKey start="^Rules-Requires-Root: *" end="$" contains=debcontrolR3 oneline
117syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(\%(Build-\)\=Essential\|Protected\): *" end="$" contains=debcontrolYesNo oneline
118
119syn region debcontrolStrictField matchgroup=debcontrolDeprecatedKey start="^\%(XS-\)\=DM-Upload-Allowed: *" end="$" contains=debcontrolDmUpload oneline
120
121" Associate our matches and regions with pretty colours
122hi def link debcontrolKey Keyword
123hi def link debcontrolField Normal
…lines 124–127 unchanged (4 lines)
128hi def link debcontrolMultiArch Normal
129hi def link debcontrolName Normal
130hi def link debcontrolPriority Normal
131hi def link debcontrolSection Normal
132hi def link debcontrolPackageType Normal
133hi def link debcontrolVariable Identifier
134hi def link debcontrolArchSpec Identifier
135hi def link debcontrolBuildProfile Identifier
136hi def link debcontrolEmail Identifier
137hi def link debcontrolVcsSvn Identifier
138hi def link debcontrolVcsCvs Identifier
139hi def link debcontrolVcsGit Identifier
140hi def link debcontrolHTTPUrl Identifier
141hi def link debcontrolDmUpload Identifier
…lines 142–153 unchanged (12 lines)