" Vim syntax file " Language: Debian preseed " Maintainer: cos , https://www.netizen.se/#contact " Last Change: 2023 Nov 2 " Remark: https://wiki.debian.org/DebianInstaller/Preseed " quit when a syntax file was already loaded if exists('b:current_syntax') finish endif " The syntax of each line in a preseed file follows: " " Lets sloppily refer to them as columns. " Out in the wild, there appears to be two preseed questions which fail to " match the syntax rules. According to preseed.debian.net, these two are: " " debian-installer/shell-plugin and sitesummary-client/nagios-server " " The first one takes the `terminal` question type (rather than `boolean`, " `string`, `password`, `select`, `multiselect` or `note`). Attempting to ask " about this on #debian-boot gave the classic (non-)warm welcoming from one of " the regulars there. That person claimed to have investigated the issue and " stated that it is correct as it is. Followed up with a polite but clear " instruction to shut-up. " " The second one is described as an internal hidden debconf question, and has " 'db_get' injected between the owner and the question name fields. That could " either be a clever hack or a bug. No investigation has been done to figure " out which. " Create clusters for two of these four columns of a preseed line. syntax cluster preseedSecond contains=preseedQuestion,preseedOwnerLC syntax cluster preseedThird contains=preseedBooleanType,preseedStrLikeType,preseedMultiSelType,preseedNote,preseedSelectType,preseedQuestionLC " Define the highlighting. Doesn't map perfectly to the group's intents, but " arguably close enough? " First column, hi! def link preseedOwner Label " Second column, hi! def link preseedQuestion Identifier " Third column, hi! def link preseedBooleanType Type hi! def link preseedMultiSelType Type hi! def link preseedNote Type hi! def link preseedSelectType Type hi! def link preseedStrLikeType Type " Fourth column, hi! def link preseedBooleanVal Special hi! def link preseedMultiSelVal Special hi! def link preseedStrLikeVal String hi! def link preseedVal String hi! def link preseedSelectVal Special hi! def link preseedMultiSelSep Operator hi! def link preseedComment Comment " Line Continuation hi! def link preseedOwnerLC Operator hi! def link preseedQuestionLC Operator hi! def link preseedBooleanLC Operator hi! def link preseedMultiSelLC Operator hi! def link preseedStrLikeLC Operator " Add the syntax matching rules. " First, sy match preseedOwner /^\s*[[:alnum:]._-]\+\(\s\|$\)/ nextgroup=@preseedSecond,preseedOwnerLC " Second, sy match preseedQuestion contained "\s*\([[:alnum:]._-]\+/\)\+[[:alnum:]._-]\+\(\s\|$\)" nextgroup=@preseedThird,preseedQuestionLC " Third, " (boolean, multiselect, note, password, select, string) sy match preseedBooleanType contained /\s*boolean\(\s\|$\)/ nextgroup=preseedBooleanVal,preseedBooleanLC sy match preseedMultiSelType contained /\s*multiselect\(\s\|$\)/ nextgroup=preseedMultiSelVal,preseedMultiSelLC sy match preseedNote contained /\s*note$/ sy match preseedSelectType contained /\s*select\(\s\|$\)/ nextgroup=preseedSelectVal,preseedSelectLC sy match preseedStrLikeType contained /\s*\(password\|string\)\(\s\|$\)/ nextgroup=preseedStrLikeVal,preseedStrLikeLC " Fourth, sy match preseedBooleanVal contained /\s*\(false\|true\)/ sy match preseedMultiSelVal contained /.*/me=e contains=preseedMultiSelSep sy match preseedMultiSelVal contained /.*\\/me=e-1 contains=preseedMultiSelSep nextgroup=preseedMultiSelLC sy match preseedMultiSelSep contained /,/ sy match preseedSelectVal contained /.*/ sy match preseedStrLikeVal contained /.*/me=e sy match preseedStrLikeVal contained /.*\\/me=e-1 nextgroup=preseedStrLikeLC " Line continuation needs to be down here override everything other syntax. sy match preseedBooleanLC contained /\s*\\$/ nextgroup=preseedBooleanVal,preseedBooleanLC skipnl sy match preseedMultiSelLC contained /\\$/ nextgroup=preseedMultiSelVal skipnl sy match preseedOwnerLC contained /\s*\\$/ nextgroup=@preseedSecond skipnl sy match preseedQuestionLC contained /\s*\\$/ nextgroup=@preseedThird skipnl sy match preseedSelectLC contained /\s*\\$/ nextgroup=preseedSelectVal,preseedSelectLC skipnl sy match preseedStrLikeLC contained /\\$/ nextgroup=preseedStrLikeVal skipnl " And comments must override everything else. sy match preseedComment /^\s*#.*/