Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Squid config file |
| 3 | " Maintainer: Klaus Muth <klaus@hampft.de> |
| 4 | " Last Change: 2004 Feb 01 |
| 5 | " URL: http://www.hampft.de/vim/syntax/squid.vim |
| 6 | " ThanksTo: Ilya Sher <iso8601@mail.ru> |
| 7 | |
| 8 | |
| 9 | " For version 5.x: Clear all syntax items |
| 10 | " For version 6.x: Quit when a syntax file was already loaded |
| 11 | if version < 600 |
| 12 | syntax clear |
| 13 | elseif exists("b:current_syntax") |
| 14 | finish |
| 15 | endif |
| 16 | |
| 17 | " squid.conf syntax seems to be case insensitive |
| 18 | syn case ignore |
| 19 | |
| 20 | syn keyword squidTodo contained TODO |
| 21 | syn match squidComment "#.*$" contains=squidTodo,squidTag |
| 22 | syn match squidTag contained "TAG: .*$" |
| 23 | |
| 24 | " Lots & lots of Keywords! |
| 25 | syn keyword squidConf acl always_direct announce_host |
| 26 | syn keyword squidConf announce_period announce_port announce_to |
| 27 | syn keyword squidConf anonymize_headers append_domain |
| 28 | syn keyword squidConf as_whois_server authenticate_children |
| 29 | syn keyword squidConf authenticate_program authenticate_ttl |
| 30 | syn keyword squidConf broken_posts buffered_logs cache_access_log |
| 31 | syn keyword squidConf cache_announce cache_dir cache_dns_program |
| 32 | syn keyword squidConf cache_effective_group cache_effective_user |
| 33 | syn keyword squidConf cache_host cache_host_acl cache_host_domain |
| 34 | syn keyword squidConf cache_log cache_mem cache_mem_high |
| 35 | syn keyword squidConf cache_mem_low cache_mgr cachemgr_passwd |
| 36 | syn keyword squidConf cache_peer cache_stoplist |
| 37 | syn keyword squidConf cache_stoplist_pattern cache_store_log |
| 38 | syn keyword squidConf cache_swap cache_swap_high cache_swap_log |
| 39 | syn keyword squidConf cache_swap_low client_db client_lifetime |
| 40 | syn keyword squidConf client_netmask connect_timeout coredump_dir |
| 41 | syn keyword squidConf dead_peer_timeout debug_options delay_access |
| 42 | syn keyword squidConf delay_class delay_initial_bucket_level |
| 43 | syn keyword squidConf delay_parameters delay_pools dns_children |
| 44 | syn keyword squidConf dns_defnames dns_nameservers dns_testnames |
| 45 | syn keyword squidConf emulate_httpd_log err_html_text |
| 46 | syn keyword squidConf fake_user_agent firewall_ip forwarded_for |
| 47 | syn keyword squidConf forward_snmpd_port fqdncache_size |
| 48 | syn keyword squidConf ftpget_options ftpget_program ftp_list_width |
| 49 | syn keyword squidConf ftp_user half_closed_clients |
| 50 | syn keyword squidConf hierarchy_stoplist htcp_port http_access |
| 51 | syn keyword squidConf http_anonymizer httpd_accel httpd_accel_host |
| 52 | syn keyword squidConf httpd_accel_port httpd_accel_uses_host_header |
| 53 | syn keyword squidConf httpd_accel_with_proxy http_port |
| 54 | syn keyword squidConf http_reply_access icp_access icp_hit_stale |
| 55 | syn keyword squidConf icp_port icp_query_timeout ident_lookup |
| 56 | syn keyword squidConf ident_lookup_access ident_timeout |
| 57 | syn keyword squidConf incoming_http_average incoming_icp_average |
| 58 | syn keyword squidConf inside_firewall ipcache_high ipcache_low |
| 59 | syn keyword squidConf ipcache_size local_domain local_ip |
| 60 | syn keyword squidConf logfile_rotate log_fqdn log_icp_queries |
| 61 | syn keyword squidConf log_mime_hdrs maximum_object_size |
| 62 | syn keyword squidConf maximum_single_addr_tries mcast_groups |
| 63 | syn keyword squidConf mcast_icp_query_timeout mcast_miss_addr |
| 64 | syn keyword squidConf mcast_miss_encode_key mcast_miss_port |
| 65 | syn keyword squidConf memory_pools mime_table min_http_poll_cnt |
| 66 | syn keyword squidConf min_icp_poll_cnt minimum_direct_hops |
| 67 | syn keyword squidConf minimum_retry_timeout miss_access |
| 68 | syn keyword squidConf negative_dns_ttl negative_ttl |
| 69 | syn keyword squidConf neighbor_timeout neighbor_type_domain |
| 70 | syn keyword squidConf netdb_high netdb_low netdb_ping_period |
| 71 | syn keyword squidConf netdb_ping_rate no_cache passthrough_proxy |
| 72 | syn keyword squidConf pconn_timeout pid_filename pinger_program |
| 73 | syn keyword squidConf positive_dns_ttl prefer_direct proxy_auth |
| 74 | syn keyword squidConf proxy_auth_realm query_icmp quick_abort |
| 75 | syn keyword squidConf quick_abort quick_abort_max quick_abort_min |
| 76 | syn keyword squidConf quick_abort_pct range_offset_limit |
| 77 | syn keyword squidConf read_timeout redirect_children |
| 78 | syn keyword squidConf redirect_program |
| 79 | syn keyword squidConf redirect_rewrites_host_header reference_age |
| 80 | syn keyword squidConf reference_age refresh_pattern reload_into_ims |
| 81 | syn keyword squidConf request_size request_timeout |
| 82 | syn keyword squidConf shutdown_lifetime single_parent_bypass |
| 83 | syn keyword squidConf siteselect_timeout snmp_access |
| 84 | syn keyword squidConf snmp_incoming_address snmp_port source_ping |
| 85 | syn keyword squidConf ssl_proxy store_avg_object_size |
| 86 | syn keyword squidConf store_objects_per_bucket strip_query_terms |
| 87 | syn keyword squidConf swap_level1_dirs swap_level2_dirs |
| 88 | syn keyword squidConf tcp_incoming_address tcp_outgoing_address |
| 89 | syn keyword squidConf tcp_recv_bufsize test_reachability |
| 90 | syn keyword squidConf udp_hit_obj udp_hit_obj_size |
| 91 | syn keyword squidConf udp_incoming_address udp_outgoing_address |
| 92 | syn keyword squidConf unique_hostname unlinkd_program |
| 93 | syn keyword squidConf uri_whitespace useragent_log visible_hostname |
| 94 | syn keyword squidConf wais_relay wais_relay_host wais_relay_port |
| 95 | |
| 96 | syn keyword squidOpt proxy-only weight ttl no-query default |
| 97 | syn keyword squidOpt round-robin multicast-responder |
| 98 | syn keyword squidOpt on off all deny allow |
| 99 | |
| 100 | " Security Actions for cachemgr_passwd |
| 101 | syn keyword squidAction shutdown info parameter server_list |
| 102 | syn keyword squidAction client_list |
| 103 | syn match squidAction "stats/\(objects\|vm_objects\|utilization\|ipcache\|fqdncache\|dns\|redirector\|io\|reply_headers\|filedescriptors\|netdb\)" |
| 104 | syn match squidAction "log\(/\(status\|enable\|disable\|clear\)\)\=" |
| 105 | syn match squidAction "squid\.conf" |
| 106 | |
| 107 | " Keywords for the acl-config |
| 108 | syn keyword squidAcl url_regex urlpath_regex referer_regex port proto |
| 109 | syn keyword squidAcl req_mime_type rep_mime_type |
| 110 | syn keyword squidAcl method browser user src dst |
| 111 | |
| 112 | syn match squidNumber "\<\d\+\>" |
| 113 | syn match squidIP "\<\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\>" |
| 114 | syn match squidStr "\(^\s*acl\s\+\S\+\s\+\(\S*_regex\|re[pq]_mime_type\|browser\|_domain\|user\)\+\s\+\)\@<=.*" contains=squidRegexOpt |
| 115 | syn match squidRegexOpt contained "\(^\s*acl\s\+\S\+\s\+\S\+\(_regex\|_mime_type\)\s\+\)\@<=[-+]i\s\+" |
| 116 | |
| 117 | " All config is in one line, so this has to be sufficient |
| 118 | " Make it fast like hell :) |
| 119 | syn sync minlines=3 |
| 120 | |
| 121 | " Define the default highlighting. |
| 122 | " For version 5.7 and earlier: only when not done already |
| 123 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 124 | if version >= 508 || !exists("did_squid_syntax_inits") |
| 125 | if version < 508 |
| 126 | let did_squid_syntax_inits = 1 |
| 127 | command -nargs=+ HiLink hi link <args> |
| 128 | else |
| 129 | command -nargs=+ HiLink hi def link <args> |
| 130 | endif |
| 131 | |
| 132 | HiLink squidTodo Todo |
| 133 | HiLink squidComment Comment |
| 134 | HiLink squidTag Special |
| 135 | HiLink squidConf Keyword |
| 136 | HiLink squidOpt Constant |
| 137 | HiLink squidAction String |
| 138 | HiLink squidNumber Number |
| 139 | HiLink squidIP Number |
| 140 | HiLink squidAcl Keyword |
| 141 | HiLink squidStr String |
| 142 | HiLink squidRegexOpt Special |
| 143 | |
| 144 | delcommand HiLink |
| 145 | endif |
| 146 | |
| 147 | let b:current_syntax = "squid" |
| 148 | |
| 149 | " vim: ts=8 |