vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

dnsmasq.vim (13556B)


      1 " Vim syntax file
      2 " Maintainer:	Thilo Six
      3 " Contact:	vim-foo@xk2c-foo.de
      4 "		:3s+-foo++g
      5 " Description:	highlight dnsmasq configuration files
      6 " File:		runtime/syntax/dnsmasq.vim
      7 " Version:	2.76
      8 " Last Change:	2015 Sep 27
      9 " 2026 Jun 23 by Vim project update dnsmasq keywords #20616
     10 " Modeline:	vim: ts=8:sw=2:sts=2:
     11 "
     12 " License:	VIM License
     13 "		Vim is Charityware, see ":help Uganda"
     14 "
     15 " Options:	You might want to add this to your vimrc:
     16 "
     17 "		if &background == "dark"
     18 "		    let dnsmasq_backrgound_light = 0
     19 "		else
     20 "		    let dnsmasq_backrgound_light = 1
     21 "		endif
     22 "
     23 
     24 " quit when a syntax file was already loaded
     25 if exists("b:current_syntax") || &compatible
     26     finish
     27 endif
     28 
     29 let s:cpo_save = &cpo
     30 set cpo&vim
     31 
     32 if !exists("b:dnsmasq_backrgound_light")
     33     if exists("dnsmasq_backrgound_light")
     34 	let b:dnsmasq_backrgound_light = dnsmasq_backrgound_light
     35     else
     36 	let b:dnsmasq_backrgound_light = 0
     37     endif
     38 endif
     39 
     40 
     41 " case on
     42 syn case match
     43 
     44 syn match   DnsmasqValues   "=.*"hs=s+1 contains=DnsmasqComment,DnsmasqSpecial
     45 syn match   DnsmasqSpecial  display '=\|@\|,\|!\|:'	  nextgroup=DnsmasqValues
     46 syn match   DnsmasqSpecial  "#"
     47 
     48 syn match   DnsmasqIPv4	    "\<\(\(25\_[0-5]\|2\_[0-4]\_[0-9]\|\_[01]\?\_[0-9]\_[0-9]\?\)\.\)\{3\}\(25\_[0-5]\|2\_[0-4]\_[0-9]\|\_[01]\?\_[0-9]\_[0-9]\?\)\>"	nextgroup=DnsmasqSubnet2,DnsmasqRange
     49 syn match   DnsmasqSubnet   "\<255.\(\(25\_[0-5]\|2\_[0-4]\_[0-9]\|\_[01]\?\_[0-9]\_[0-9]\?\)\.\)\{2\}\(25\_[0-5]\|2\_[0-4]\_[0-9]\|\_[01]\?\_[0-9]\_[0-9]\?\)\>"
     50 syn match   DnsmasqSubnet2  contained "\/\([0-4]\?[0-9]\)\>"
     51 syn match   DnsmasqRange    contained "-"
     52 syn match   DnsmasqMac	    "\<\(\x\x\?:\)\{5}\x\x\?"
     53 
     54 syn match   DnsmasqTime	    "\<\(\d\{1,3}\)[hm]\>"
     55 
     56 " String
     57 syn match   DnsmasqString   "\".*\""  contains=@Spell
     58 syn match   DnsmasqString   "'.*'"    contains=@Spell
     59 
     60 " Comments
     61 syn keyword DnsmasqTodo	    FIXME TODO XXX NOTE contained
     62 syn match   DnsmasqComment  "\(^\|\s\+\)#.*$"   contains=@Spell,DnsmasqTodo
     63 
     64 " highlight trailing spaces
     65 syn match   DnsmasqTrailSpace	   "[ \t]\+$"
     66 syn match   DnsmasqTrailSpace	   "[ \t]\+$" containedin=ALL
     67 
     68 syn match DnsmasqKeywordSpecial    "\<set\>:"me=e-1
     69 syn match DnsmasqKeywordSpecial    "\<tag\>:"me=e-1
     70 syn match DnsmasqKeywordSpecial    ",\<static\>"hs=s+1	  contains=DnsmasqSpecial
     71 syn match DnsmasqKeywordSpecial    ",\<infinite\>"hs=s+1  contains=DnsmasqSpecial
     72 syn match DnsmasqKeywordSpecial    "\<encap\>:"me=e-1
     73 syn match DnsmasqKeywordSpecial    "\<interface\>:"me=e-1
     74 syn match DnsmasqKeywordSpecial    "\<vi-encap\>:"me=e-1
     75 syn match DnsmasqKeywordSpecial    "\<net\>:"me=e-1
     76 syn match DnsmasqKeywordSpecial    "\<vendor\>:"me=e-1
     77 syn match DnsmasqKeywordSpecial    "\<opt\>:"me=e-1
     78 syn match DnsmasqKeywordSpecial    "\<option\>:"me=e-1
     79 syn match DnsmasqKeywordSpecial    ",\<ignore\>"hs=s+1	  contains=DnsmasqSpecial
     80 syn match DnsmasqKeywordSpecial    "\<id\>:"me=e-1
     81 
     82 syn match DnsmasqKeyword    "^\s*\zsadd-cpe-id\>"
     83 syn match DnsmasqKeyword    "^\s*\zsadd-mac\>"
     84 syn match DnsmasqKeyword    "^\s*\zsadd-subnet\>"
     85 syn match DnsmasqKeyword    "^\s*\zsaddn-hosts\>"
     86 syn match DnsmasqKeyword    "^\s*\zsaddress\>"
     87 syn match DnsmasqKeyword    "^\s*\zsalias\>"
     88 syn match DnsmasqKeyword    "^\s*\zsall-servers\>"
     89 syn match DnsmasqKeyword    "^\s*\zsauth-peer\>"
     90 syn match DnsmasqKeyword    "^\s*\zsauth-sec-servers\>"
     91 syn match DnsmasqKeyword    "^\s*\zsauth-server\>"
     92 syn match DnsmasqKeyword    "^\s*\zsauth-soa\>"
     93 syn match DnsmasqKeyword    "^\s*\zsauth-ttl\>"
     94 syn match DnsmasqKeyword    "^\s*\zsauth-zone\>"
     95 syn match DnsmasqKeyword    "^\s*\zsbind-dynamic\>"
     96 syn match DnsmasqKeyword    "^\s*\zsbind-interfaces\>"
     97 syn match DnsmasqKeyword    "^\s*\zsbogus-nxdomain\>"
     98 syn match DnsmasqKeyword    "^\s*\zsbogus-priv\>"
     99 syn match DnsmasqKeyword    "^\s*\zsbootp-dynamic\>"
    100 syn match DnsmasqKeyword    "^\s*\zsbridge-interface\>"
    101 syn match DnsmasqKeyword    "^\s*\zscaa-record\>"
    102 syn match DnsmasqKeyword    "^\s*\zscache-rr\>"
    103 syn match DnsmasqKeyword    "^\s*\zscache-size\>"
    104 syn match DnsmasqKeyword    "^\s*\zsclear-on-reload\>"
    105 syn match DnsmasqKeyword    "^\s*\zscname\>"
    106 syn match DnsmasqKeyword    "^\s*\zsconf-dir\>"
    107 syn match DnsmasqKeyword    "^\s*\zsconf-file\>"
    108 syn match DnsmasqKeyword    "^\s*\zsconf-script\>"
    109 syn match DnsmasqKeyword    "^\s*\zsconnmark-allowlist-enable\>"
    110 syn match DnsmasqKeyword    "^\s*\zsconnmark-allowlist\>"
    111 syn match DnsmasqKeyword    "^\s*\zsconntrack\>"
    112 syn match DnsmasqKeyword    "^\s*\zsdhcp-alternate-port\>"
    113 syn match DnsmasqKeyword    "^\s*\zsdhcp-authoritative\>"
    114 syn match DnsmasqKeyword    "^\s*\zsdhcp-boot\>"
    115 syn match DnsmasqKeyword    "^\s*\zsdhcp-broadcast\>"
    116 syn match DnsmasqKeyword    "^\s*\zsdhcp-circuitid\>"
    117 syn match DnsmasqKeyword    "^\s*\zsdhcp-client-update\>"
    118 syn match DnsmasqKeyword    "^\s*\zsdhcp-duid\>"
    119 syn match DnsmasqKeyword    "^\s*\zsdhcp-fqdn\>"
    120 syn match DnsmasqKeyword    "^\s*\zsdhcp-generate-names\>"
    121 syn match DnsmasqKeyword    "^\s*\zsdhcp-host\>"
    122 syn match DnsmasqKeyword    "^\s*\zsdhcp-hostsdir\>"
    123 syn match DnsmasqKeyword    "^\s*\zsdhcp-hostsfile\>"
    124 syn match DnsmasqKeyword    "^\s*\zsdhcp-ignore-clid\>"
    125 syn match DnsmasqKeyword    "^\s*\zsdhcp-ignore-names\>"
    126 syn match DnsmasqKeyword    "^\s*\zsdhcp-ignore\>"
    127 syn match DnsmasqKeyword    "^\s*\zsdhcp-lease-max\>"
    128 syn match DnsmasqKeyword    "^\s*\zsdhcp-leasefile\>"
    129 syn match DnsmasqKeyword    "^\s*\zsdhcp-luascript\>"
    130 syn match DnsmasqKeyword    "^\s*\zsdhcp-mac\>"
    131 syn match DnsmasqKeyword    "^\s*\zsdhcp-match\>"
    132 syn match DnsmasqKeyword    "^\s*\zsdhcp-name-match\>"
    133 syn match DnsmasqKeyword    "^\s*\zsdhcp-no-override\>"
    134 syn match DnsmasqKeyword    "^\s*\zsdhcp-option-force\>"
    135 syn match DnsmasqKeyword    "^\s*\zsdhcp-option-pxe\>"
    136 syn match DnsmasqKeyword    "^\s*\zsdhcp-option\>"
    137 syn match DnsmasqKeyword    "^\s*\zsdhcp-optsdir\>"
    138 syn match DnsmasqKeyword    "^\s*\zsdhcp-optsfile\>"
    139 syn match DnsmasqKeyword    "^\s*\zsdhcp-proxy\>"
    140 syn match DnsmasqKeyword    "^\s*\zsdhcp-pxe-vendor\>"
    141 syn match DnsmasqKeyword    "^\s*\zsdhcp-range\>"
    142 syn match DnsmasqKeyword    "^\s*\zsdhcp-rapid-commit\>"
    143 syn match DnsmasqKeyword    "^\s*\zsdhcp-relay\>"
    144 syn match DnsmasqKeyword    "^\s*\zsdhcp-remoteid\>"
    145 syn match DnsmasqKeyword    "^\s*\zsdhcp-reply-delay\>"
    146 syn match DnsmasqKeyword    "^\s*\zsdhcp-script\>"
    147 syn match DnsmasqKeyword    "^\s*\zsdhcp-scriptuser\>"
    148 syn match DnsmasqKeyword    "^\s*\zsdhcp-sequential-ip\>"
    149 syn match DnsmasqKeyword    "^\s*\zsdhcp-split-relay\>"
    150 syn match DnsmasqKeyword    "^\s*\zsdhcp-subscrid\>"
    151 syn match DnsmasqKeyword    "^\s*\zsdhcp-ttl\>"
    152 syn match DnsmasqKeyword    "^\s*\zsdhcp-userclass\>"
    153 syn match DnsmasqKeyword    "^\s*\zsdhcp-vendorclass\>"
    154 syn match DnsmasqKeyword    "^\s*\zsdns-forward-max\>"
    155 syn match DnsmasqKeyword    "^\s*\zsdns-loop-detect\>"
    156 syn match DnsmasqKeyword    "^\s*\zsdns-rr\>"
    157 syn match DnsmasqKeyword    "^\s*\zsdnssec-check-unsigned\>"
    158 syn match DnsmasqKeyword    "^\s*\zsdnssec-debug\>"
    159 syn match DnsmasqKeyword    "^\s*\zsdnssec-limits\>"
    160 syn match DnsmasqKeyword    "^\s*\zsdnssec-no-timecheck\>"
    161 syn match DnsmasqKeyword    "^\s*\zsdnssec-timestamp\>"
    162 syn match DnsmasqKeyword    "^\s*\zsdnssec\>"
    163 syn match DnsmasqKeyword    "^\s*\zsdo-0x20-encode\>"
    164 syn match DnsmasqKeyword    "^\s*\zsdo-x20-encode\>"
    165 syn match DnsmasqKeyword    "^\s*\zsdomain-needed\>"
    166 syn match DnsmasqKeyword    "^\s*\zsdomain\>"
    167 syn match DnsmasqKeyword    "^\s*\zsdumpfile\>"
    168 syn match DnsmasqKeyword    "^\s*\zsdumpmask\>"
    169 syn match DnsmasqKeyword    "^\s*\zsdynamic-host\>"
    170 syn match DnsmasqKeyword    "^\s*\zsedns-packet-max\>"
    171 syn match DnsmasqKeyword    "^\s*\zsenable-dbus\>"
    172 syn match DnsmasqKeyword    "^\s*\zsenable-ra\>"
    173 syn match DnsmasqKeyword    "^\s*\zsenable-tftp\>"
    174 syn match DnsmasqKeyword    "^\s*\zsenable-ubus\>"
    175 syn match DnsmasqKeyword    "^\s*\zsexcept-interface\>"
    176 syn match DnsmasqKeyword    "^\s*\zsexpand-hosts\>"
    177 syn match DnsmasqKeyword    "^\s*\zsfast-dns-retry\>"
    178 syn match DnsmasqKeyword    "^\s*\zsfilter-AAAA\>"
    179 syn match DnsmasqKeyword    "^\s*\zsfilter-A\>"
    180 syn match DnsmasqKeyword    "^\s*\zsfilter-rr\>"
    181 syn match DnsmasqKeyword    "^\s*\zsfilterwin2k\>"
    182 syn match DnsmasqKeyword    "^\s*\zsgroup\>"
    183 syn match DnsmasqKeyword    "^\s*\zshelp\>"
    184 syn match DnsmasqKeyword    "^\s*\zshost-record\>"
    185 syn match DnsmasqKeyword    "^\s*\zshostsdir\>"
    186 syn match DnsmasqKeyword    "^\s*\zsignore-address\>"
    187 syn match DnsmasqKeyword    "^\s*\zsinterface-name\>"
    188 syn match DnsmasqKeyword    "^\s*\zsinterface\>"
    189 syn match DnsmasqKeyword    "^\s*\zsipset\>"
    190 syn match DnsmasqKeyword    "^\s*\zskeep-in-foreground\>"
    191 syn match DnsmasqKeyword    "^\s*\zsleasefile-ro\>"
    192 syn match DnsmasqKeyword    "^\s*\zsleasequery\>"
    193 syn match DnsmasqKeyword    "^\s*\zslisten-address\>"
    194 syn match DnsmasqKeyword    "^\s*\zslocal-service\>"
    195 syn match DnsmasqKeyword    "^\s*\zslocal-ttl\>"
    196 syn match DnsmasqKeyword    "^\s*\zslocal\>"
    197 syn match DnsmasqKeyword    "^\s*\zslocalise-queries\>"
    198 syn match DnsmasqKeyword    "^\s*\zslocalmx\>"
    199 syn match DnsmasqKeyword    "^\s*\zslog-async\>"
    200 syn match DnsmasqKeyword    "^\s*\zslog-debug\>"
    201 syn match DnsmasqKeyword    "^\s*\zslog-dhcp\>"
    202 syn match DnsmasqKeyword    "^\s*\zslog-facility\>"
    203 syn match DnsmasqKeyword    "^\s*\zslog-malloc\>"
    204 syn match DnsmasqKeyword    "^\s*\zslog-queries\>"
    205 syn match DnsmasqKeyword    "^\s*\zsmax-cache-ttl\>"
    206 syn match DnsmasqKeyword    "^\s*\zsmax-port\>"
    207 syn match DnsmasqKeyword    "^\s*\zsmax-tcp-connections\>"
    208 syn match DnsmasqKeyword    "^\s*\zsmax-ttl\>"
    209 syn match DnsmasqKeyword    "^\s*\zsmin-cache-ttl\>"
    210 syn match DnsmasqKeyword    "^\s*\zsmin-port\>"
    211 syn match DnsmasqKeyword    "^\s*\zsmx-host\>"
    212 syn match DnsmasqKeyword    "^\s*\zsmx-target\>"
    213 syn match DnsmasqKeyword    "^\s*\zsnaptr-record\>"
    214 syn match DnsmasqKeyword    "^\s*\zsneg-ttl\>"
    215 syn match DnsmasqKeyword    "^\s*\zsnftset\>"
    216 syn match DnsmasqKeyword    "^\s*\zsno-0x20-encode\>"
    217 syn match DnsmasqKeyword    "^\s*\zsno-daemon\>"
    218 syn match DnsmasqKeyword    "^\s*\zsno-dhcp-interface\>"
    219 syn match DnsmasqKeyword    "^\s*\zsno-dhcpv4-interface\>"
    220 syn match DnsmasqKeyword    "^\s*\zsno-dhcpv6-interface\>"
    221 syn match DnsmasqKeyword    "^\s*\zsno-hosts\>"
    222 syn match DnsmasqKeyword    "^\s*\zsno-ident\>"
    223 syn match DnsmasqKeyword    "^\s*\zsno-negcache\>"
    224 syn match DnsmasqKeyword    "^\s*\zsno-ping\>"
    225 syn match DnsmasqKeyword    "^\s*\zsno-poll\>"
    226 syn match DnsmasqKeyword    "^\s*\zsno-resolv\>"
    227 syn match DnsmasqKeyword    "^\s*\zsno-round-robin\>"
    228 syn match DnsmasqKeyword    "^\s*\zspid-file\>"
    229 syn match DnsmasqKeyword    "^\s*\zsport-limit\>"
    230 syn match DnsmasqKeyword    "^\s*\zsport\>"
    231 syn match DnsmasqKeyword    "^\s*\zsproxy-dnssec\>"
    232 syn match DnsmasqKeyword    "^\s*\zsptr-record\>"
    233 syn match DnsmasqKeyword    "^\s*\zspxe-prompt\>"
    234 syn match DnsmasqKeyword    "^\s*\zspxe-service\>"
    235 syn match DnsmasqKeyword    "^\s*\zsquery-port\>"
    236 syn match DnsmasqKeyword    "^\s*\zsquiet-dhcp6\>"
    237 syn match DnsmasqKeyword    "^\s*\zsquiet-dhcp\>"
    238 syn match DnsmasqKeyword    "^\s*\zsquiet-ra\>"
    239 syn match DnsmasqKeyword    "^\s*\zsquiet-tftp\>"
    240 syn match DnsmasqKeyword    "^\s*\zsra-param\>"
    241 syn match DnsmasqKeyword    "^\s*\zsread-ethers\>"
    242 syn match DnsmasqKeyword    "^\s*\zsrebind-domain-ok\>"
    243 syn match DnsmasqKeyword    "^\s*\zsrebind-localhost-ok\>"
    244 syn match DnsmasqKeyword    "^\s*\zsresolv-file\>"
    245 syn match DnsmasqKeyword    "^\s*\zsrev-server\>"
    246 syn match DnsmasqKeyword    "^\s*\zsscript-arp\>"
    247 syn match DnsmasqKeyword    "^\s*\zsscript-on-renewal\>"
    248 syn match DnsmasqKeyword    "^\s*\zsselfmx\>"
    249 syn match DnsmasqKeyword    "^\s*\zsserver\>"
    250 syn match DnsmasqKeyword    "^\s*\zsservers-file\>"
    251 syn match DnsmasqKeyword    "^\s*\zsshared-network\>"
    252 syn match DnsmasqKeyword    "^\s*\zssrv-host\>"
    253 syn match DnsmasqKeyword    "^\s*\zsstop-dns-rebind\>"
    254 syn match DnsmasqKeyword    "^\s*\zsstrict-order\>"
    255 syn match DnsmasqKeyword    "^\s*\zsstrip-mac\>"
    256 syn match DnsmasqKeyword    "^\s*\zsstrip-subnet\>"
    257 syn match DnsmasqKeyword    "^\s*\zssynth-domain\>"
    258 syn match DnsmasqKeyword    "^\s*\zstag-if\>"
    259 syn match DnsmasqKeyword    "^\s*\zstest\>"
    260 syn match DnsmasqKeyword    "^\s*\zstftp-lowercase\>"
    261 syn match DnsmasqKeyword    "^\s*\zstftp-max\>"
    262 syn match DnsmasqKeyword    "^\s*\zstftp-mtu\>"
    263 syn match DnsmasqKeyword    "^\s*\zstftp-no-blocksize\>"
    264 syn match DnsmasqKeyword    "^\s*\zstftp-no-fail\>"
    265 syn match DnsmasqKeyword    "^\s*\zstftp-port-range\>"
    266 syn match DnsmasqKeyword    "^\s*\zstftp-root\>"
    267 syn match DnsmasqKeyword    "^\s*\zstftp-secure\>"
    268 syn match DnsmasqKeyword    "^\s*\zstftp-single-port\>"
    269 syn match DnsmasqKeyword    "^\s*\zstftp-unique-root\>"
    270 syn match DnsmasqKeyword    "^\s*\zstrust-anchor\>"
    271 syn match DnsmasqKeyword    "^\s*\zstxt-record\>"
    272 syn match DnsmasqKeyword    "^\s*\zsumbrella\>"
    273 syn match DnsmasqKeyword    "^\s*\zsuse-stale-cache\>"
    274 syn match DnsmasqKeyword    "^\s*\zsuser\>"
    275 syn match DnsmasqKeyword    "^\s*\zsversion\>"
    276 
    277 
    278 if b:dnsmasq_backrgound_light == 1
    279     hi def DnsmasqKeyword	ctermfg=DarkGreen guifg=DarkGreen
    280 else
    281     hi def link DnsmasqKeyword  Keyword
    282 endif
    283 hi def link DnsmasqKeywordSpecial Type
    284 hi def link DnsmasqTodo		Todo
    285 hi def link DnsmasqSpecial	Constant
    286 hi def link DnsmasqIPv4		Identifier
    287 hi def link DnsmasqSubnet2	DnsmasqSubnet
    288 hi def link DnsmasqSubnet	DnsmasqMac
    289 hi def link DnsmasqRange	DnsmasqMac
    290 hi def link DnsmasqMac		Preproc
    291 hi def link DnsmasqTime		Preproc
    292 hi def link DnsmasqComment	Comment
    293 hi def link DnsmasqTrailSpace	DiffDelete
    294 hi def link DnsmasqString	Constant
    295 hi def link DnsmasqValues	Normal
    296 
    297 let b:current_syntax = "dnsmasq"
    298 
    299 let &cpo = s:cpo_save
    300 unlet s:cpo_save
    301