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