xref: /vim-8.2.3635/runtime/syntax/aptconf.vim (revision 0c5fa7d7)
1" Vim syntax file
2" Language:	APT config file
3" Maintainer:	Yann Amar <[email protected]>
4" Last Change:	2012 Oct 05
5
6" For version 5.x: Clear all syntax items
7" For version 6.x and 7.x: Quit when a syntax file was already loaded
8if !exists("main_syntax")
9  if version < 600
10    syntax clear
11  elseif exists("b:current_syntax")
12    finish
13  endif
14  let main_syntax = 'aptconf'
15endif
16
17let s:cpo_save = &cpo
18set cpo&vim
19
20" Errors:
21" Catch all that is not overridden by next rules/items:
22syn match	aptconfError		display '[^[:blank:]]'
23syn match	aptconfError		display '^[^[:blank:]][^:{]*'
24
25" Options:
26" Define a general regular expression for the options that are not defined
27" later as keywords. Following apt.conf(5), we know that options are case
28" insensitive, and can contain alphanumeric characters and '/-:._+'; we
29" assume that there can not be consecutive colons (::) which is used as
30" syntax operator; we also assume that an option name can not start or end
31" by a colon.
32syn case	ignore
33syn match	aptconfRegexpOpt	'[-[:alnum:]/.+_]\+\(:[-[:alnum:]/.+_]\+\)*' contained display
34
35" Keywords:
36setlocal iskeyword+=/,-,.,_,+
37"setlocal iskeyword+=: is problematic, because of the '::' separator
38
39" Incomplete keywords will be treated differently than completely bad strings:
40syn keyword	aptconfGroupIncomplete
41	\ a[cquire] a[ptitude] d[ebtags] d[ebug] d[ir] d[pkg] d[select]
42	\ o[rderlist] p[ackagemanager] p[kgcachegen] q[uiet] r[pm]
43	\ u[nattended-upgrade]
44
45" Only the following keywords can be used at toplevel (to begin an option):
46syn keyword	aptconfGroup
47	\ acquire apt aptitude debtags debug dir dpkg dselect
48	\ orderlist packagemanager pkgcachegen quiet rpm
49	\ unattended-upgrade
50
51" Possible options for each group:
52" Acquire: {{{
53syn keyword	aptconfAcquire contained
54	\ cdrom Check-Valid-Until CompressionTypes ForceHash ftp gpgv
55	\ GzipIndexes http https Languages Max-ValidTime Min-ValidTime PDiffs
56	\ Queue-Mode Retries Source-Symlinks
57
58syn keyword	aptconfAcquireCDROM contained
59	\ AutoDetect CdromOnly Mount UMount
60
61syn keyword	aptconfAcquireCompressionTypes contained
62	\ bz2 lzma gz Order
63
64syn keyword	aptconfAcquireFTP contained
65	\ Passive Proxy ProxyLogin Timeout
66
67syn keyword	aptconfAcquireHTTP contained
68	\ AllowRedirect Dl-Limit Max-Age No-Cache No-Store Pipeline-Depth
69	\ Proxy Timeout User-Agent
70
71syn keyword	aptconfAcquireHTTPS contained
72	\ CaInfo CaPath CrlFile IssuerCert SslCert SslForceVersion SslKey
73	\ Verify-Host Verify-Peer
74
75syn keyword	aptconfAcquireMaxValidTime contained
76	\ Debian Debian-Security
77
78syn keyword	aptconfAcquirePDiffs contained
79	\ FileLimit SizeLimit
80
81syn cluster	aptconfAcquire_ contains=aptconfAcquire,
82	\ aptconfAcquireCDROM,aptconfAcquireCompressionTypes,aptconfAcquireFTP,
83	\ aptconfAcquireHTTP,aptconfAcquireHTTPS,aptconfAcquireMaxValidTime,
84	\ aptconfAcquirePDiffs
85" }}}
86" Apt: {{{
87syn keyword	aptconfApt contained
88	\ Architecture Architectures Archive Authentication AutoRemove
89	\ Build-Essential Cache Cache-Grow Cache-Limit Cache-Start CDROM
90	\ Changelogs Clean-Installed Compressor Default-Release
91	\ Force-LoopBreak Get Ignore-Hold Immediate-Configure
92	\ Install-Recommends Install-Suggests Keep-Fds List-Cleanup
93	\ NeverAutoRemove Never-MarkAuto-Sections Periodic Status-Fd Update
94
95syn keyword	aptconfAptAuthentication contained
96	\ TrustCDROM
97
98syn keyword	aptconfAptAutoRemove contained
99	\ RecommendsImportant SuggestsImportant
100
101syn keyword	aptconfAptCache contained
102	\ AllNames AllVersions Generate GivenOnly Important Installed NamesOnly
103	\ RecurseDepends ShowFull
104
105syn keyword	aptconfAptCDROM contained
106	\ Fast NoAct NoMount Rename
107
108syn keyword	aptconfAptChangelogs contained
109	\ Server
110
111syn keyword	aptconfAptCompressor contained
112	\ bzip2 gzip lzma xz
113
114syn keyword	aptconfAptCompressorAll contained
115	\ Binary CompressArg Cost Extension Name UncompressArg
116
117syn keyword	aptconfAptGet contained
118	\ AllowUnauthenticated Arch-Only Assume-No Assume-Yes AutomaticRemove
119	\ Build-Dep-Automatic Compile Diff-Only Download Download-Only Dsc-Only
120	\ Fix-Broken Fix-Missing Force-Yes HideAutoRemove Host-Architecture
121	\ List-Cleanup Only-Source Print-URIs Purge ReInstall Remove
122	\ Show-Upgraded Show-User-Simulation-Note Show-Versions Simulate
123	\ Tar-Only Trivial-Only Upgrade
124
125syn keyword	aptconfAptPeriodic contained
126	\ AutocleanInterval BackupArchiveInterval BackupLevel
127	\ Download-Upgradeable-Packages MaxAge MaxSize MinAge
128	\ Unattended-Upgrade Update-Package-Lists Verbose
129
130syn keyword	aptconfAptUpdate contained
131	\ Pre-Invoke Post-Invoke Post-Invoke-Success
132
133syn cluster	aptconfApt_ contains=aptconfApt,
134	\ aptconfAptAuthentication,aptconfAptAutoRemove,aptconfAptCache,
135	\ aptconfAptCDROM,aptconfAptChangelogs,aptconfAptCompressor,
136	\ aptconfAptCompressorAll,aptconfAptGet,aptconfAptPeriodic,
137	\ aptconfAptUpdate
138" }}}
139" Aptitude: {{{
140syn keyword	aptconfAptitude contained
141	\ Allow-Null-Upgrade Always-Use-Safe-Resolver Autoclean-After-Update
142	\ Auto-Install Auto-Fix-Broken Cmdline Debtags-Binary
143	\ Debtags-Update-Options Delete-Unused Delete-Unused-Pattern
144	\ Display-Planned-Action Forget-New-On-Install Forget-New-On-Update
145	\ Get-Root-Command Ignore-Old-Tmp Ignore-Recommends-Important
146	\ Keep-Recommends Keep-Suggests Keep-Unused-Pattern LockFile Log
147	\ Logging Parse-Description-Bullets Pkg-Display-Limit ProblemResolver
148	\ Purge-Unused Recommends-Important Safe-Resolver Screenshot Sections
149	\ Simulate Spin-Interval Suggests-Important Suppress-Read-Only-Warning
150	\ Theme Track-Dselect-State UI Warn-Not-Root
151
152syn keyword	aptconfAptitudeCmdline contained
153	\ Always-Prompt Assume-Yes Disable-Columns Download-Only Fix-Broken
154	\ Ignore-Trust-Violations Package-Display-Format Package-Display-Width
155	\ Progress Request-Strictness Resolver-Debug Resolver-Dump
156	\ Resolver-Show-Steps Safe-Upgrade Show-Deps Show-Size-Changes
157	\ Show-Versions Show-Why Simulate Verbose Version-Display-Format
158	\ Versions-Group-By Versions-Show-Package-Names Visual-Preview
159	\ Why-Display-Mode
160
161syn keyword	aptconfAptitudeCmdlineProgress contained
162	\ Percent-On-Right Retain-Completed
163
164syn keyword	aptconfAptitudeCmdlineSafeUpgrade contained
165	\ No-New-Installs
166
167syn keyword	aptconfAptitudeLogging contained
168	\ File Levels
169
170syn keyword	aptconfAptitudeProblemResolver contained
171	\ Allow-Break-Holds BreakHoldScore Break-Hold-Level BrokenScore
172	\ DefaultResolutionScore Discard-Null-Solution
173	\ EssentialRemoveScore ExtraScore FullReplacementScore FutureHorizon
174	\ Hints ImportantScore Infinity InstallScore Keep-All-Level KeepScore
175	\ NonDefaultScore Non-Default-Level OptionalScore PreserveAutoScore
176	\ PreserveManualScore RemoveScore Remove-Essential-Level Remove-Level
177	\ RequiredScore ResolutionScore Safe-Level SolutionCost StandardScore
178	\ StepLimit StepScore Trace-Directory Trace-File
179	\ UndoFullReplacementScore UnfixedSoftScore UpgradeScore
180
181syn keyword	aptconfAptitudeSafeResolver contained
182	\ No-New-Installs No-New-Upgrades Show-Resolver-Actions
183
184syn keyword	aptconfAptitudeScreenshot contained
185	\ Cache-Max IncrementalLoadLimit
186
187syn keyword	aptconfAptitudeSections contained
188	\ Descriptions Top-Sections
189
190syn keyword	aptconfAptitudeUI contained
191	\ Advance-On-Action Auto-Show-Reasons Default-Grouping
192	\ Default-Package-View Default-Preview-Grouping Default-Sorting
193	\ Description-Visible-By-Default Exit-On-Last-Close Fill-Text
194	\ Flat-View-As-First-View HelpBar Incremental-Search InfoAreaTabs
195	\ KeyBindings MenuBar-Autohide Minibuf-Download-Bar Minibuf-Prompts
196	\ New-package-Commands Package-Display-Format Package-Header-Format
197	\ Package-Status-Format Pause-After-Download Preview-Limit
198	\ Prompt-On-Exit Styles ViewTabs
199
200syn keyword	aptconfAptitudeUIStyles contained
201	\ Bullet ChangeLogNewerVersion Default DepBroken DisabledMenuEntry
202	\ DownloadHit DownloadProgress EditLine Error Header HighlightedMenuBar
203	\ HighlightedMenuEntry MediaChange MenuBar MenuBorder MenuEntry
204	\ MineBomb MineBorder MineFlag MineNumber1 MineNumber2 MineNumber3
205	\ MineNumber4 MineNumber5 MineNumber6 MineNumber7 MineNumber8
206	\ MultiplexTab MultiplexTabHighlighted PkgBroken PkgBrokenHighlighted
207	\ PkgIsInstalled PkgIsInstalledHighlighted PkgNotInstalled
208	\ PkgNotInstalledHighlighted PkgToDowngrade PkgToDowngradeHighlighted
209	\ PkgToHold PkgToHoldHighlighted PkgToInstall PkgToInstallHighlighted
210	\ PkgToRemove PkgToRemoveHighlighted PkgToUpgrade
211	\ PkgToUpgradeHighlighted Progress SolutionActionApproved
212	\ SolutionActionRejected Status TreeBackground TrustWarning
213
214syn keyword	aptconfAptitudeUIStylesElements contained
215	\ bg clear fg flip set
216
217syn cluster	aptconfAptitude_ contains=aptconfAptitude,
218	\ aptconfAptitudeCmdline,aptconfAptitudeCmdlineProgress,
219	\ aptconfAptitudeCmdlineSafeUpgrade,aptconfAptitudeLogging,
220	\ aptconfAptitudeProblemResolver,aptconfAptitudeSafeResolver,
221	\ aptconfAptitudeScreenshot,aptconfAptitudeSections,aptconfAptitudeUI,
222	\ aptconfAptitudeUIStyles,aptconfAptitudeUIStylesElements
223" }}}
224" DebTags: {{{
225syn keyword	aptconfDebTags contained
226	\ Vocabulary
227
228syn cluster	aptconfDebTags_ contains=aptconfDebTags
229" }}}
230" Debug: {{{
231syn keyword	aptconfDebug contained
232	\ Acquire aptcdrom BuildDeps Hashes IdentCdrom Nolocking
233	\ pkgAcquire pkgAutoRemove pkgCacheGen pkgDepCache pkgDPkgPM
234	\ pkgDPkgProgressReporting pkgInitialize pkgOrderList
235	\ pkgPackageManager pkgPolicy pkgProblemResolver sourceList
236
237syn keyword	aptconfDebugAcquire contained
238	\ cdrom Ftp gpgv Http Https netrc
239
240syn keyword	aptconfDebugPkgAcquire contained
241	\ Auth Diffs RRed Worker
242
243syn keyword	aptconfDebugPkgDepCache contained
244	\ AutoInstall Marker
245
246syn keyword	aptconfDebugPkgProblemResolver contained
247	\ ShowScores
248
249syn cluster	aptconfDebug_ contains=aptconfDebug,
250	\ aptconfDebugAcquire,aptconfDebugPkgAcquire,aptconfDebugPkgDepCache,
251	\ aptconfDebugPkgProblemResolver
252" }}}
253" Dir: {{{
254syn keyword	aptconfDir contained
255	\ Aptitude Bin Cache Etc Ignore-Files-Silently Log Media Parts RootDir
256	\ State
257
258syn keyword	aptconfDirAptitude contained
259	\ state
260
261syn keyword	aptconfDirBin contained
262	\ apt-get apt-cache dpkg dpkg-buildpackage dpkg-source gpg gzip Methods
263	\ solvers
264
265syn keyword	aptconfDirCache contained
266	\ Archives Backup pkgcache srcpkgcache
267
268syn keyword	aptconfDirEtc contained
269	\ Main Netrc Parts Preferences PreferencesParts SourceList SourceParts
270	\ VendorList VendorParts Trusted TrustedParts
271
272syn keyword	aptconfDirLog contained
273	\ History Terminal
274
275syn keyword	aptconfDirMedia contained
276	\ MountPath
277
278syn keyword	aptconfDirState contained
279	\ cdroms extended_states Lists mirrors status
280
281syn cluster	aptconfDir_ contains=aptconfDir,
282	\ aptconfDirAptitude,aptconfDirBin,aptconfDirCache,aptconfDirEtc,
283	\ aptconfDirLog,aptconfDirMedia,aptconfDirState
284" }}}
285" DPkg: {{{
286syn keyword	aptconfDPkg contained
287	\ Build-Options Chroot-Directory ConfigurePending FlushSTDIN MaxArgs
288	\ MaxBytes NoTriggers options Pre-Install-Pkgs Pre-Invoke Post-Invoke
289	\ Run-Directory StopOnError Tools TriggersPending
290
291syn keyword	aptconfDPkgTools contained
292	\ Options Version
293
294syn cluster	aptconfDPkg_ contains=aptconfDPkg,
295	\ aptconfDPkgOrderList,aptconfDPkgOrderListScore,aptconfDPkgTools
296" }}}
297" DSelect: {{{
298syn keyword	aptconfDSelect contained
299	\ CheckDir Clean Options PromptAfterUpdate UpdateOptions
300
301syn cluster	aptconfDSelect_ contains=aptconfDSelect
302" }}}
303" OrderList: {{{
304syn keyword	aptconfOrderList contained
305	\ Score
306
307syn keyword	aptconfOrderListScore contained
308	\ Delete Essential Immediate PreDepends
309
310syn cluster	aptconfOrderList_ contains=aptconfOrderList,
311	\ aptconfOrderListScore
312" }}}
313" PackageManager: {{{
314syn keyword	aptconfPackageManager contained
315	\ Configure
316
317syn cluster	aptconfPackageManager_ contains=aptconfPackageManager
318" }}}
319" PkgCacheGen: {{{
320syn keyword	aptconfPkgCacheGen contained
321	\ Essential
322
323syn cluster	aptconfPkgCacheGen_ contains=aptconfPkgCacheGen
324" }}}
325" Quiet: {{{
326syn keyword	aptconfQuiet contained
327	\ NoUpdate
328
329syn cluster	aptconfQuiet_ contains=aptconfQuiet
330" }}}
331" Rpm: {{{
332syn keyword	aptconfRpm contained
333	\ Post-Invoke Pre-Invoke
334
335syn cluster	aptconfRpm_ contains=aptconfRpm
336" }}}
337" Unattened Upgrade: {{{
338syn keyword	aptconfUnattendedUpgrade contained
339	\ AutoFixInterruptedDpkg Automatic-Reboot InstallOnShutdown Mail
340	\ MailOnlyOnError MinimalSteps Origins-Pattern Package-Blacklist
341	\ Remove-Unused-Dependencies
342
343syn cluster	aptconfUnattendedUpgrade_ contains=aptconfUnattendedUpgrade
344" }}}
345
346syn case	match
347
348" Now put all the keywords (and 'valid' options) in a single cluster:
349syn cluster	aptconfOptions contains=aptconfRegexpOpt,
350	\ @aptconfAcquire_,@aptconfApt_,@aptconfAptitude_,@aptconfDebTags_,
351	\ @aptconfDebug_,@aptconfDir_,@aptconfDPkg_,@aptconfDSelect_,
352	\ @aptconfOrderList_,@aptconfPackageManager_,@aptconfPkgCacheGen_,
353	\ @aptconfQuiet_,@aptconfRpm_,@aptconfUnattendedUpgrade_
354
355" Syntax:
356syn match	aptconfSemiColon	';'
357syn match	aptconfDoubleColon	'::'
358syn match	aptconfCurlyBraces	'[{}]'
359syn region	aptconfValue		start='"' end='"' oneline display
360syn region	aptconfInclude		matchgroup=aptconfOperator start='{' end='}' contains=ALLBUT,aptconfGroup,aptconfGroupIncomplete,@aptconfCommentSpecial
361syn region	aptconfInclude		matchgroup=aptconfOperator start='::' end='{'me=s-1 contains=@aptconfOptions,aptconfError display
362syn region	aptconfInclude		matchgroup=aptconfOperator start='::' end='::\|\s'me=s-1 oneline contains=@aptconfOptions,aptconfError display
363
364" Basic Syntax Errors: XXX avoid to generate false positives !!!
365"
366" * Invalid comment format (seems to not cause errors, but...):
367syn match	aptconfAsError		display '^#.*'
368"
369" * When a semicolon is missing after a double-quoted string:
370" There are some cases (for example in the Dir group of options, but not only)
371" where this syntax is valid. So we don't treat it as a strict error.
372syn match	aptconfAsError		display '"[^"]*"[^;]'me=e-1
373syn match	aptconfAsError		display '"[^"]*"$'
374"
375" * When double quotes are missing around a value (before a semicolon):
376" This omission has no effect if the value is a single string (without blank
377" characters). But apt.conf(5) says that quotes are required, and this item
378" avoids to match unquoted keywords.
379syn match	aptconfAsError		display '\s[^"[:blank:]]*[^}"];'me=e-1
380"
381" * When only one double quote is missing around a value (before a semicolon):
382" No comment for that: it must be highly visible.
383syn match	aptconfError		display '\(\s\|;\)"[^"[:blank:]]\+;'me=e-1
384syn match	aptconfError		display '\(\s\|;\)[^"[:blank:]]\+";'me=e-1
385"
386" * When space is missing between option and (quoted) value:
387" TODO (partially implemented)
388syn match	aptconfError		display '::[^[:blank:]]*"'
389
390" Special Actions:
391syn match	aptconfAction		'^#\(clear\|include\)\>'
392syn region	aptconfAction		matchgroup=aptconfAction start='^#clear\>' end=';'me=s-1 oneline contains=aptconfGroup,aptconfDoubleColon,@aptconfOptions
393syn region	aptconfAction		matchgroup=aptconfAction start='^#include\>' end=';'me=s-1 oneline contains=aptconfRegexpOpt
394
395" Comments:
396syn keyword	aptconfTodo		TODO FIXME NOTE XXX contained
397syn cluster	aptconfCommentSpecial	contains=@Spell,aptconfTodo
398syn match	aptconfComment		'//.*' contains=@aptconfCommentSpecial
399syn region	aptconfComment		start='/\*' end='\*/' contains=@aptconfCommentSpecial
400
401" Highlight Definitions:
402hi def link aptconfTodo				Todo
403hi def link aptconfError			Error
404hi def link aptconfComment			Comment
405hi def link aptconfOperator			Operator
406
407hi def link aptconfAction			PreProc
408hi def link aptconfOption			Type
409hi def link aptconfValue			String
410hi def link aptconfRegexpOpt			Normal
411hi def link aptconfAsError			Special
412
413hi def link aptconfSemiColon			aptconfOperator
414hi def link aptconfDoubleColon			aptconfOperator
415hi def link aptconfCurlyBraces			aptconfOperator
416
417hi def link aptconfGroupIncomplete		Special
418hi def link aptconfGroup			aptconfOption
419
420hi def link aptconfAcquire			aptconfOption
421hi def link aptconfAcquireCDROM			aptconfOption
422hi def link aptconfAcquireCompressionTypes	aptconfOption
423hi def link aptconfAcquireFTP			aptconfOption
424hi def link aptconfAcquireHTTP			aptconfOption
425hi def link aptconfAcquireHTTPS			aptconfOption
426hi def link aptconfAcquireMaxValidTime		aptconfOption
427hi def link aptconfAcquirePDiffs		aptconfOption
428
429hi def link aptconfApt				aptconfOption
430hi def link aptconfAptAuthentication		aptconfOption
431hi def link aptconfAptAutoRemove		aptconfOption
432hi def link aptconfAptCache			aptconfOption
433hi def link aptconfAptCDROM			aptconfOption
434hi def link aptconfAptChangelogs		aptconfOption
435hi def link aptconfAptCompressor		aptconfOption
436hi def link aptconfAptCompressorAll		aptconfOption
437hi def link aptconfAptGet			aptconfOption
438hi def link aptconfAptPeriodic			aptconfOption
439hi def link aptconfAptUpdate			aptconfOption
440
441hi def link aptconfAptitude			aptconfOption
442hi def link aptconfAptitudeCmdline		aptconfOption
443hi def link aptconfAptitudeCmdlineProgress	aptconfOption
444hi def link aptconfAptitudeCmdlineSafeUpgrade	aptconfOption
445hi def link aptconfAptitudeLogging		aptconfOption
446hi def link aptconfAptitudeProblemResolver	aptconfOption
447hi def link aptconfAptitudeSafeResolver		aptconfOption
448hi def link aptconfAptitudeScreenshot		aptconfOption
449hi def link aptconfAptitudeSections		aptconfOption
450hi def link aptconfAptitudeUI			aptconfOption
451hi def link aptconfAptitudeUIStyles		aptconfOption
452hi def link aptconfAptitudeUIStylesElements	aptconfOption
453
454hi def link aptconfDebTags			aptconfOption
455
456hi def link aptconfDebug			aptconfOption
457hi def link aptconfDebugAcquire			aptconfOption
458hi def link aptconfDebugPkgAcquire		aptconfOption
459hi def link aptconfDebugPkgDepCache		aptconfOption
460hi def link aptconfDebugPkgProblemResolver	aptconfOption
461
462hi def link aptconfDir				aptconfOption
463hi def link aptconfDirAptitude			aptconfOption
464hi def link aptconfDirBin			aptconfOption
465hi def link aptconfDirCache			aptconfOption
466hi def link aptconfDirEtc			aptconfOption
467hi def link aptconfDirLog			aptconfOption
468hi def link aptconfDirMedia			aptconfOption
469hi def link aptconfDirState			aptconfOption
470
471hi def link aptconfDPkg				aptconfOption
472hi def link aptconfDPkgTools			aptconfOption
473
474hi def link aptconfDSelect			aptconfOption
475
476hi def link aptconfOrderList			aptconfOption
477hi def link aptconfOrderListScore		aptconfOption
478
479hi def link aptconfPackageManager		aptconfOption
480
481hi def link aptconfPkgCacheGen			aptconfOption
482
483hi def link aptconfQuiet			aptconfOption
484
485hi def link aptconfRpm				aptconfOption
486
487hi def link aptconfUnattendedUpgrade		aptconfOption
488
489let b:current_syntax = "aptconf"
490
491let &cpo = s:cpo_save
492unlet s:cpo_save
493
494