neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

privoxy.vim (5388B)


      1 " Vim syntax file
      2 " Language:	Privoxy actions file
      3 " Maintainer:	Doug Kearns <dougkearns@gmail.com>
      4 " Last Change:	2026 Jan 07
      5 
      6 " Privoxy 4.1.0
      7 
      8 if exists("b:current_syntax")
      9  finish
     10 endif
     11 
     12 let s:cpo_save = &cpo
     13 set cpo&vim
     14 
     15 syn region privoxyActionsBlock matchgroup=privoxyBraces start="^\s*\zs{" end="}"
     16 \ contains=@privoxyActionPrefix,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*\zs{{settings\}}"    contains=privoxyBraces nextgroup=privoxySettingsSection skipnl skipwhite
    139 syn match privoxyDescriptionHeader "^\s*\zs{{description\}}" contains=privoxyBraces nextgroup=privoxyDescriptionSection skipnl
    140 syn match privoxyAliasHeader	   "^\s*\zs{{alias\}}"	     contains=privoxyBraces nextgroup=privoxyAliasSection skipnl
    141 
    142 syn region privoxySettingsSection    start="." end="^\s*\ze{" contained contains=privoxyComment,privoxySettingName
    143 syn region privoxyDescriptionSection start="." end="^\s*\ze{" contained
    144 syn region privoxyAliasSection	     start="." end="^\s*\ze{" 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
    158 syn match   privoxyComment "#.*" contains=privoxyTodo,@Spell
    159 
    160 hi def link privoxyAction		Identifier
    161 hi def link privoxyAliasEqual		Operator
    162 hi def link privoxyAliasHeader		Title
    163 hi def link privoxyBraces		Delimiter
    164 hi 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
    176 hi def link privoxyTodo			Todo
    177 
    178 let b:current_syntax = "privoxy"
    179 
    180 let &cpo = s:cpo_save
    181 unlet s:cpo_save
    182 
    183 " vim: ts=8 fdm=marker