11" Vim syntax file
22" Language: Privoxy actions file
33" Maintainer: Doug Kearns <dougkearns@gmail.com>
4- " URL: http://gus.gscit.monash.edu.au/~djkea2/vim/syntax/privoxy.vim
5- " Last Change: 2007 Mar 30
4+ " Last Change: 2026 Jan 07
65
7- " Privoxy 3.0.6
6+ " Privoxy 4.1.0
87
98if exists (" b:current_syntax" )
109 finish
@@ -13,59 +12,172 @@ endif
1312let s: cpo_save = &cpo
1413set cpo &vim
1514
16- setlocal iskeyword = @ ,48 - 57 ,_,-
17-
18- syn keyword privoxyTodo contained TODO FIXME XXX NOTE
15+ syn region privoxyActionsBlock matchgroup =privoxyBraces start =" ^\s *\z s{" end =" }"
16+ \ contains= @p rivoxyActionPrefix,privoxyLineContinuation
17+
18+ " Actions {{{
19+ let s: actions = << trim END
20+ add - header
21+ block
22+ change - x - forwarded- for
23+ client- header- filter
24+ client- body- filter
25+ client- body- tagger
26+ client- header- tagger
27+ content- type - overwrite
28+ crunch- client- header
29+ crunch- if - none - match
30+ crunch- incoming- cookies
31+ crunch- outgoing- cookies
32+ crunch- server- header
33+ deanimate- gifs
34+ delay- response
35+ downgrade- http- version
36+ external- filter
37+ fast- redirects
38+ filter
39+ filter - client- headers
40+ filter - server- headers
41+ force- text- mode
42+ forward- override
43+ handle- as - empty - document
44+ handle- as - image
45+ hide - accept- language
46+ hide - content- disposition
47+ hide - forwarded- for - headers
48+ hide - from- header
49+ hide - if - modified - since
50+ hide - referrer
51+ hide - referer
52+ hide - user - agent
53+ https- inspection
54+ ignore - certificate- errors
55+ limit- connect
56+ limit- cookie- lifetime
57+ prevent- compression
58+ prevent- keeping- cookies
59+ overwrite- last - modified
60+ redirect
61+ server- header- filter
62+ server- header- tagger
63+ suppress- tag
64+ session- cookies- only
65+ set - image- blocker
66+ END
67+
68+ for s: action in s: actions
69+ exe ' syn match privoxyAction "\<' .. s: action .. ' \>" contained nextgroup=privoxyParams'
70+ endfor
71+ unlet s: action s: actions
72+
73+ syn region privoxyParams matchgroup =privoxyParamBraces start =" {" end =" }" contained
74+
75+ syn match privoxyFilterAction " \< filter\> -\@ !" contained nextgroup =privoxyFilterParams
76+ syn region privoxyFilterParams matchgroup =privoxyParamBraces start =" {" end =" }" contained contains =privoxyFilterArg
77+
78+ syn cluster privoxyAction contains =privoxyAction,privoxyFilterAction
79+ " }}}
80+
81+ " Filters {{{
82+ let s: filters = << trim END
83+ allow- autocompletion
84+ all - popups
85+ banners- by- link
86+ banners- by- size
87+ blogspot
88+ bundeswehr
89+ content- cookies
90+ crude- parental
91+ demoronizer
92+ frameset- borders
93+ fun
94+ github
95+ google
96+ html- annoyances
97+ ie- exploits
98+ iframes
99+ imdb
100+ img- reorder
101+ js - annoyances
102+ js - events
103+ jumping- windows
104+ msn
105+ no -ping
106+ quicktime- kioskmode
107+ refresh- tags
108+ shockwave- flash
109+ site- specifics
110+ sourceforge
111+ tiny- textforms
112+ unsolicited- popups
113+ webbugs
114+ yahoo
115+ x - httpd- php- to - html
116+ html- to - xml
117+ xml- to - html
118+ less- download- windows
119+ privoxy- control
120+ hide - tor- exit - notation
121+ no -brotli-accepted
122+ privoxy- control
123+ remove - first - byte
124+ remove - test
125+ overwrite- test- value
126+ END
127+
128+ for s: filter in s: filters
129+ exe ' syn match privoxyFilterArg "\<' .. s: filter .. ' \>" contained"'
130+ endfor
131+ unlet s: filter s: filters
132+ " }}}
133+
134+ syn match privoxyEnablePrefix " \% (^\|\s\| {\)\@ 1<=+\l\@ =" nextgroup =privoxy.*Action contained
135+ syn match privoxyDisablePrefix " \% (^\|\s\| {\)\@ 1<=-\l\@ =" nextgroup =privoxy.*Action contained
136+ syn cluster privoxyActionPrefix contains =privoxyDisablePrefix,privoxyEnablePrefix
137+
138+ syn match privoxySettingsHeader " ^\s *\z s{{settings\} }" contains =privoxyBraces nextgroup =privoxySettingsSection skipnl skipwhite
139+ syn match privoxyDescriptionHeader " ^\s *\z s{{description\} }" contains =privoxyBraces nextgroup =privoxyDescriptionSection skipnl
140+ syn match privoxyAliasHeader " ^\s *\z s{{alias\} }" contains =privoxyBraces nextgroup =privoxyAliasSection skipnl
141+
142+ syn region privoxySettingsSection start =" ." end =" ^\s *\z e{" contained contains =privoxyComment,privoxySettingName
143+ syn region privoxyDescriptionSection start =" ." end =" ^\s *\z e{" contained
144+ syn region privoxyAliasSection start =" ." end =" ^\s *\z e{" contained contains =privoxyComment,privoxyAliasName
145+
146+ syn match privoxySettingName " \< [a-z][a-z-]*" contained nextgroup =privoxySettingEqual
147+ syn match privoxySettingEqual " =" contained nextgroup =privoxySettingValue
148+ syn match privoxySettingValue " .*" contained
149+
150+ syn match privoxyAliasName " [+-]\< [a-z][a-z-]*" contained nextgroup =privoxyAliasEqual skipwhite
151+ syn match privoxyAliasEqual " =" contained nextgroup =privoxyAliasValue skipwhite
152+ syn region privoxyAliasValue start =" \S " skip =" \\ $" end =" $" contained contains =@privoxyAction,@privoxyActionPrefix,privoxyLineContinuation
153+
154+ syn match privoxyBraces " [{}]" contained
155+ syn match privoxyLineContinuation " \\ $" contained
156+
157+ syn keyword privoxyTodo TODO FIXME XXX NOTE contained
19158syn match privoxyComment " #.*" contains =privoxyTodo,@Spell
20159
21- syn region privoxyActionLine matchgroup =privoxyActionLineDelimiter start =" ^\s *\z s{" end =" }\z e\s *$"
22- \ contains= privoxyEnabledPrefix,privoxyDisabledPrefix
23-
24- syn match privoxyEnabledPrefix " \% (^\|\s\| {\)\@ <=+\l\@ =" nextgroup =privoxyAction,privoxyFilterAction contained
25- syn match privoxyDisabledPrefix " \% (^\|\s\| {\)\@ <=-\l\@ =" nextgroup =privoxyAction,privoxyFilterAction contained
26-
27- syn match privoxyAction " \% (add-header\| block\| content-type-overwrite\| crunch-client-header\| crunch-if-none-match\)\> " contained
28- syn match privoxyAction " \% (crunch-incoming-cookies\| crunch-outgoing-cookies\| crunch-server-header\| deanimate-gifs\)\> " contained
29- syn match privoxyAction " \% (downgrade-http-version\| fast-redirects\| filter-client-headers\| filter-server-headers\)\> " contained
30- syn match privoxyAction " \% (filter\| force-text-mode\| handle-as-empty-document\| handle-as-image\)\> " contained
31- syn match privoxyAction " \% (hide-accept-language\| hide-content-disposition\| hide-forwarded-for-headers\)\> " contained
32- syn match privoxyAction " \% (hide-from-header\| hide-if-modified-since\| hide-referrer\| hide-user-agent\| inspect-jpegs\)\> " contained
33- syn match privoxyAction " \% (kill-popups\| limit-connect\| overwrite-last-modified\| prevent-compression\| redirect\)\> " contained
34- syn match privoxyAction " \% (send-vanilla-wafer\| send-wafer\| session-cookies-only\| set-image-blocker\)\> " contained
35- syn match privoxyAction " \% (treat-forbidden-connects-like-blocks\)\> "
36-
37- syn match privoxyFilterAction " filter{[^}]*}" contained contains =privoxyFilterArg,privoxyActionBraces
38- syn match privoxyActionBraces " [{}]" contained
39- syn keyword privoxyFilterArg js- annoyances js- events html- annoyances content- cookies refresh- tags unsolicited- popups all- popups
40- \ img- reorder banners- by- size banners- by- link webbugs tiny- textforms jumping- windows frameset- borders demoronizer
41- \ shockwave- flash quicktime- kioskmode fun crude- parental ie- exploits site- specifics no -ping google yahoo msn blogspot
42- \ x-httpd-php-to-html html-to-xml xml-to-html hide-tor-exit-notation contained
43-
44- " Alternative spellings
45- syn match privoxyAction " \% (kill-popup\| hide-referer\| prevent-keeping-cookies\)\> " contained
46-
47- " Pre-3.0 compatibility
48- syn match privoxyAction " \% (no-cookie-read\| no-cookie-set\| prevent-reading-cookies\| prevent-setting-cookies\)\> " contained
49- syn match privoxyAction " \% (downgrade\| hide-forwarded\| hide-from\| image\| image-blocker\| no-compression\)\> " contained
50- syn match privoxyAction " \% (no-cookies-keep\| no-cookies-read\| no-cookies-set\| no-popups\| vanilla-wafer\| wafer\)\> " contained
51-
52- syn match privoxySetting " \< for-privoxy-version\> "
53-
54- syn match privoxyHeader " ^\s *\z s{{\% (alias\| settings\) }}\z e\s *$"
55-
56160hi def link privoxyAction Identifier
57- hi def link privoxyFilterAction Identifier
58- hi def link privoxyActionLineDelimiter Delimiter
59- hi def link privoxyDisabledPrefix SpecialChar
60- hi def link privoxyEnabledPrefix SpecialChar
61- hi def link privoxyHeader PreProc
62- hi def link privoxySetting Identifier
63- hi def link privoxyFilterArg Constant
64-
161+ hi def link privoxyAliasEqual Operator
162+ hi def link privoxyAliasHeader Title
163+ hi def link privoxyBraces Delimiter
65164hi def link privoxyComment Comment
165+ hi def link privoxyDescriptionHeader Title
166+ hi def link privoxyDisablePrefix Added
167+ hi def link privoxyEnablePrefix Removed
168+ hi def link privoxyFilterAction privoxyAction
169+ hi def link privoxyFilterArg Constant
170+ hi def link privoxyLineContinuation Special
171+ hi def link privoxyParamBraces privoxyBraces
172+ hi def link privoxySettingEqual Operator
173+ hi def link privoxySettingName Keyword
174+ hi def link privoxySettingsHeader Title
175+ hi def link privoxySettingValue Constant
66176hi def link privoxyTodo Todo
67177
68178let b: current_syntax = " privoxy"
69179
70180let &cpo = s: cpo_save
71181unlet s: cpo_save
182+
183+ " vim: ts = 8 fdm = marker
0 commit comments