2 " Maintainer: Thilo Six
3 " Contact: <vim-dev at vim dot org>
4 " http://www.vim.org/maillist.php#vim-dev
6 " Description: highlight dnsmasq configuration files
7 " File: runtime/syntax/dnsmasq.vim
9 " Last Change: 2012 May 19
10 " Modeline: vim: ts=8:sw=2:sts=2:
12 " Credits: Igor N. Prischepoff
17 " License: VIM License
18 " Vim is Charityware, see ":help Uganda"
20 " Options: You might want to add this to your vimrc:
22 " if &background == "dark"
24 " let dnsmasq_backrgound_light = 0
26 " let dnsmasq_backrgound_light = 1
30 " For version 5.x: Clear all syntax items
31 " For version 6.x: Quit when a syntax file was already loaded
34 elseif exists("b:current_syntax") || &compatible
41 if !exists("b:dnsmasq_backrgound_light")
42 if exists("dnsmasq_backrgound_light")
43 let b:dnsmasq_backrgound_light = dnsmasq_backrgound_light
45 let b:dnsmasq_backrgound_light = 0
53 syn match DnsmasqValues "=.*"hs=s+1 contains=DnsmasqComment,DnsmasqSpecial
54 syn match DnsmasqSpecial display '=\|@\|,\|!\|:' nextgroup=DnsmasqValues
55 syn match DnsmasqSpecial "#"
57 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
58 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]\?\)\>"
59 syn match DnsmasqSubnet2 contained "\/\([0-4]\?[0-9]\)\>"
60 syn match DnsmasqRange contained "-"
61 syn match DnsmasqMac "\<\(\x\x\?:\)\{5}\x\x\?"
63 syn match DnsmasqTime "\<\(\d\{1,3}\)[hm]\>"
66 syn match DnsmasqString "\".*\"" contains=@Spell
67 syn match DnsmasqString "'.*'" contains=@Spell
70 syn keyword DnsmasqTodo FIXME TODO XXX NOTE contained
71 syn match DnsmasqComment "\(^\|\s\+\)#.*$" contains=@Spell,DnsmasqTodo
73 " highlight trailing spaces
74 syn match DnsmasqTrailSpace "[ \t]\+$"
75 syn match DnsmasqTrailSpace "[ \t]\+$" containedin=ALL
77 syn match DnsmasqKeywordSpecial "\<set\>:"me=e-1
78 syn match DnsmasqKeywordSpecial "\<tag\>:"me=e-1
79 syn match DnsmasqKeywordSpecial ",\<static\>"hs=s+1 contains=DnsmasqSpecial
80 syn match DnsmasqKeywordSpecial ",\<infinite\>"hs=s+1 contains=DnsmasqSpecial
81 syn match DnsmasqKeywordSpecial "\<encap\>:"me=e-1
82 syn match DnsmasqKeywordSpecial "\<interface\>:"me=e-1
83 syn match DnsmasqKeywordSpecial "\<vi-encap\>:"me=e-1
84 syn match DnsmasqKeywordSpecial "\<net\>:"me=e-1
85 syn match DnsmasqKeywordSpecial "\<vendor\>:"me=e-1
86 syn match DnsmasqKeywordSpecial "\<opt\>:"me=e-1
87 syn match DnsmasqKeywordSpecial "\<option\>:"me=e-1
88 syn match DnsmasqKeywordSpecial ",\<ignore\>"hs=s+1 contains=DnsmasqSpecial
89 syn match DnsmasqKeywordSpecial "\<id\>:"me=e-1
91 syn match DnsmasqKeyword "^\s*add-mac\>"
92 syn match DnsmasqKeyword "^\s*addn-hosts\>"
93 syn match DnsmasqKeyword "^\s*address\>"
94 syn match DnsmasqKeyword "^\s*alias\>"
95 syn match DnsmasqKeyword "^\s*all-servers\>"
96 syn match DnsmasqKeyword "^\s*bind-interfaces\>"
97 syn match DnsmasqKeyword "^\s*bogus-nxdomain\>"
98 syn match DnsmasqKeyword "^\s*bogus-priv\>"
99 syn match DnsmasqKeyword "^\s*bootp-dynamic\>"
100 syn match DnsmasqKeyword "^\s*bridge-interface\>"
101 syn match DnsmasqKeyword "^\s*cache-size\>"
102 syn match DnsmasqKeyword "^\s*clear-on-reload\>"
103 syn match DnsmasqKeyword "^\s*cname\>"
104 syn match DnsmasqKeyword "^\s*conf-dir\>"
105 syn match DnsmasqKeyword "^\s*conf-file\>"
106 syn match DnsmasqKeyword "^\s*conntrack\>"
107 syn match DnsmasqKeyword "^\s*dhcp-alternate-port\>"
108 syn match DnsmasqKeyword "^\s*dhcp-authoritative\>"
109 syn match DnsmasqKeyword "^\s*dhcp-boot\>"
110 syn match DnsmasqKeyword "^\s*dhcp-broadcast\>"
111 syn match DnsmasqKeyword "^\s*dhcp-circuitid\>"
112 syn match DnsmasqKeyword "^\s*dhcp-client-update\>"
113 syn match DnsmasqKeyword "^\s*dhcp-duid\>"
114 syn match DnsmasqKeyword "^\s*dhcp-fqdn\>"
115 syn match DnsmasqKeyword "^\s*dhcp-generate-names\>"
116 syn match DnsmasqKeyword "^\s*dhcp-host\>"
117 syn match DnsmasqKeyword "^\s*dhcp-hostsfile\>"
118 syn match DnsmasqKeyword "^\s*dhcp-ignore\>"
119 syn match DnsmasqKeyword "^\s*dhcp-ignore-names\>"
120 syn match DnsmasqKeyword "^\s*dhcp-lease-max\>"
121 syn match DnsmasqKeyword "^\s*dhcp-leasefile\>"
122 syn match DnsmasqKeyword "^\s*dhcp-luascript\>"
123 syn match DnsmasqKeyword "^\s*dhcp-mac\>"
124 syn match DnsmasqKeyword "^\s*dhcp-match\>"
125 syn match DnsmasqKeyword "^\s*dhcp-no-override\>"
126 syn match DnsmasqKeyword "^\s*dhcp-option\>"
127 syn match DnsmasqKeyword "^\s*dhcp-option-force\>"
128 syn match DnsmasqKeyword "^\s*dhcp-optsfile\>"
129 syn match DnsmasqKeyword "^\s*dhcp-proxy\>"
130 syn match DnsmasqKeyword "^\s*dhcp-range\>"
131 syn match DnsmasqKeyword "^\s*dhcp-remoteid\>"
132 syn match DnsmasqKeyword "^\s*dhcp-script\>"
133 syn match DnsmasqKeyword "^\s*dhcp-scriptuser\>"
134 syn match DnsmasqKeyword "^\s*dhcp-sequential-ip\>"
135 syn match DnsmasqKeyword "^\s*dhcp-subscrid\>"
136 syn match DnsmasqKeyword "^\s*dhcp-userclass\>"
137 syn match DnsmasqKeyword "^\s*dhcp-vendorclass\>"
138 syn match DnsmasqKeyword "^\s*dns-forward-max\>"
139 syn match DnsmasqKeyword "^\s*domain\>"
140 syn match DnsmasqKeyword "^\s*domain-needed\>"
141 syn match DnsmasqKeyword "^\s*edns-packet-max\>"
142 syn match DnsmasqKeyword "^\s*enable-dbus\>"
143 syn match DnsmasqKeyword "^\s*enable-ra\>"
144 syn match DnsmasqKeyword "^\s*enable-tftp\>"
145 syn match DnsmasqKeyword "^\s*except-interface\>"
146 syn match DnsmasqKeyword "^\s*expand-hosts\>"
147 syn match DnsmasqKeyword "^\s*filterwin2k\>"
148 syn match DnsmasqKeyword "^\s*group\>"
149 syn match DnsmasqKeyword "^\s*host-record\>"
150 syn match DnsmasqKeyword "^\s*interface\>"
151 syn match DnsmasqKeyword "^\s*interface-name\>"
152 syn match DnsmasqKeyword "^\s*keep-in-foreground\>"
153 syn match DnsmasqKeyword "^\s*leasefile-ro\>"
154 syn match DnsmasqKeyword "^\s*listen-address\>"
155 syn match DnsmasqKeyword "^\s*local\>"
156 syn match DnsmasqKeyword "^\s*localmx\>"
157 syn match DnsmasqKeyword "^\s*local-ttl\>"
158 syn match DnsmasqKeyword "^\s*localise-queries\>"
159 syn match DnsmasqKeyword "^\s*log-async\>"
160 syn match DnsmasqKeyword "^\s*log-dhcp\>"
161 syn match DnsmasqKeyword "^\s*log-facility\>"
162 syn match DnsmasqKeyword "^\s*log-queries\>"
163 syn match DnsmasqKeyword "^\s*max-ttl\>"
164 syn match DnsmasqKeyword "^\s*min-port\>"
165 syn match DnsmasqKeyword "^\s*mx-host\>"
166 syn match DnsmasqKeyword "^\s*mx-target\>"
167 syn match DnsmasqKeyword "^\s*naptr-record\>"
168 syn match DnsmasqKeyword "^\s*neg-ttl\>"
169 syn match DnsmasqKeyword "^\s*no-daemon\>"
170 syn match DnsmasqKeyword "^\s*no-dhcp-interface\>"
171 syn match DnsmasqKeyword "^\s*no-hosts\>"
172 syn match DnsmasqKeyword "^\s*no-negcache\>"
173 syn match DnsmasqKeyword "^\s*no-ping\>"
174 syn match DnsmasqKeyword "^\s*no-poll\>"
175 syn match DnsmasqKeyword "^\s*no-resolv\>"
176 syn match DnsmasqKeyword "^\s*pid-file\>"
177 syn match DnsmasqKeyword "^\s*port\>"
178 syn match DnsmasqKeyword "^\s*proxy-dnssec\>"
179 syn match DnsmasqKeyword "^\s*ptr-record\>"
180 syn match DnsmasqKeyword "^\s*pxe-prompt\>"
181 syn match DnsmasqKeyword "^\s*pxe-service\>"
182 syn match DnsmasqKeyword "^\s*query-port\>"
183 syn match DnsmasqKeyword "^\s*read-ethers\>"
184 syn match DnsmasqKeyword "^\s*rebind-domain-ok\>"
185 syn match DnsmasqKeyword "^\s*rebind-localhost-ok\>"
186 syn match DnsmasqKeyword "^\s*resolv-file\>"
187 syn match DnsmasqKeyword "^\s*selfmx\>"
188 syn match DnsmasqKeyword "^\s*server\>"
189 syn match DnsmasqKeyword "^\s*srv-host\>"
190 syn match DnsmasqKeyword "^\s*stop-dns-rebind\>"
191 syn match DnsmasqKeyword "^\s*strict-order\>"
192 syn match DnsmasqKeyword "^\s*tag-if\>"
193 syn match DnsmasqKeyword "^\s*test\>"
194 syn match DnsmasqKeyword "^\s*tftp-max\>"
195 syn match DnsmasqKeyword "^\s*tftp-lowercase\>"
196 syn match DnsmasqKeyword "^\s*tftp-no-blocksize\>"
197 syn match DnsmasqKeyword "^\s*tftp-port-range\>"
198 syn match DnsmasqKeyword "^\s*tftp-root\>"
199 syn match DnsmasqKeyword "^\s*tftp-secure\>"
200 syn match DnsmasqKeyword "^\s*tftp-unique-root\>"
201 syn match DnsmasqKeyword "^\s*txt-record\>"
202 syn match DnsmasqKeyword "^\s*user\>"
203 syn match DnsmasqKeyword "^\s*version\>"
206 if b:dnsmasq_backrgound_light == 1
207 hi def DnsmasqKeyword ctermfg=DarkGreen guifg=DarkGreen
209 hi def link DnsmasqKeyword Keyword
211 hi def link DnsmasqKeywordSpecial Type
212 hi def link DnsmasqTodo Todo
213 hi def link DnsmasqSpecial Constant
214 hi def link DnsmasqIPv4 Identifier
215 hi def link DnsmasqSubnet2 DnsmasqSubnet
216 hi def link DnsmasqSubnet DnsmasqMac
217 hi def link DnsmasqRange DnsmasqMac
218 hi def link DnsmasqMac Preproc
219 hi def link DnsmasqTime Preproc
220 hi def link DnsmasqComment Comment
221 hi def link DnsmasqTrailSpace DiffDelete
222 hi def link DnsmasqString Constant
223 hi def link DnsmasqValues Normal
225 let b:current_syntax = "dnsmasq"
227 let &cpo = s:cpo_save