resolv.vim (6361B)
1 " Vim syntax file 2 " Language: resolver configuration file 3 " Maintainer: Radu Dineiu <radu.dineiu@gmail.com> 4 " URL: https://raw.github.com/rid9/vim-resolv/master/resolv.vim 5 " Last Change: 2020 Mar 10 6 " Version: 1.4 7 " 8 " Credits: 9 " David Necas (Yeti) <yeti@physics.muni.cz> 10 " Stefano Zacchiroli <zack@debian.org> 11 " DJ Lucas <dj@linuxfromscratch.org> 12 " 13 " Changelog: 14 " - 1.4: Added IPv6 support for sortlist. 15 " - 1.3: Added IPv6 support for IPv4 dot-decimal notation. 16 " - 1.2: Added new options. 17 " - 1.1: Added IPv6 support. 18 19 " quit when a syntax file was already loaded 20 if exists("b:current_syntax") 21 finish 22 endif 23 24 " Errors, comments and operators 25 syn match resolvError /./ 26 syn match resolvComment /\s*[#;].*$/ 27 syn match resolvOperator /[\/:]/ contained 28 29 " IP 30 syn cluster resolvIPCluster contains=resolvIPError,resolvIPSpecial 31 syn match resolvIPError /\%(\d\{4,}\|25[6-9]\|2[6-9]\d\|[3-9]\d\{2}\)[\.0-9]*/ contained 32 syn match resolvIPSpecial /\%(127\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\)/ contained 33 34 " General 35 syn match resolvIP contained /\%(\d\{1,4}\.\)\{3}\d\{1,4}/ contains=@resolvIPCluster 36 syn match resolvIPNetmask contained /\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\%(\%(\d\{1,4}\.\)\{,3}\d\{1,4}\)\)\?/ contains=resolvOperator,@resolvIPCluster 37 syn match resolvHostname contained /\w\{-}\.[-0-9A-Za-z_\.]*/ 38 39 " Nameserver IPv4 40 syn match resolvIPNameserver contained /\%(\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\s\|$\)\)\+/ contains=@resolvIPCluster 41 42 " Nameserver IPv6 43 syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{6}\%(\x\{1,4}:\x\{1,4}\)\>/ 44 syn match resolvIPNameserver contained /\s\@<=::\%(\x\{1,4}:\)\{,6}\x\{1,4}\>/ 45 syn match resolvIPNameserver contained /\s\@<=::\%(\x\{1,4}:\)\{,5}\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/ 46 syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{1}:\%(\x\{1,4}:\)\{,5}\x\{1,4}\>/ 47 syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{1}:\%(\x\{1,4}:\)\{,4}\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/ 48 syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{2}:\%(\x\{1,4}:\)\{,4}\x\{1,4}\>/ 49 syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{2}:\%(\x\{1,4}:\)\{,3}\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/ 50 syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{3}:\%(\x\{1,4}:\)\{,3}\x\{1,4}\>/ 51 syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{3}:\%(\x\{1,4}:\)\{,2}\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/ 52 syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{4}:\%(\x\{1,4}:\)\{,2}\x\{1,4}\>/ 53 syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{4}:\%(\x\{1,4}:\)\{,1}\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/ 54 syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{5}:\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/ 55 syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{6}:\x\{1,4}\>/ 56 syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{1,7}:\%(\s\|;\|$\)\@=/ 57 58 " Search hostname 59 syn match resolvHostnameSearch contained /\%(\%([-0-9A-Za-z_]\+\.\)*[-0-9A-Za-z_]\+\.\?\%(\s\|$\)\)\+/ 60 61 " Sortlist IPv4 62 syn match resolvIPNetmaskSortList contained /\%(\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\%(\%(\d\{1,4}\.\)\{,3}\d\{1,4}\)\)\?\%(\s\|$\)\)\+/ contains=resolvOperator,@resolvIPCluster 63 64 " Sortlist IPv6 65 syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{6}\%(\x\{1,4}:\x\{1,4}\)\%(\/\d\{1,3}\)\?\>/ 66 syn match resolvIPNetmaskSortList contained /\s\@<=::\%(\x\{1,4}:\)\{,6}\x\{1,4}\%(\/\d\{1,3}\)\?\>/ 67 syn match resolvIPNetmaskSortList contained /\s\@<=::\%(\x\{1,4}:\)\{,5}\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/ 68 syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{1}:\%(\x\{1,4}:\)\{,5}\x\{1,4}\%(\/\d\{1,3}\)\?\>/ 69 syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{1}:\%(\x\{1,4}:\)\{,4}\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/ 70 syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{2}:\%(\x\{1,4}:\)\{,4}\x\{1,4}\%(\/\d\{1,3}\)\?\>/ 71 syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{2}:\%(\x\{1,4}:\)\{,3}\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/ 72 syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{3}:\%(\x\{1,4}:\)\{,3}\x\{1,4}\%(\/\d\{1,3}\)\?\>/ 73 syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{3}:\%(\x\{1,4}:\)\{,2}\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/ 74 syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{4}:\%(\x\{1,4}:\)\{,2}\x\{1,4}\%(\/\d\{1,3}\)\?\>/ 75 syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{4}:\%(\x\{1,4}:\)\{,1}\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/ 76 syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{5}:\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/ 77 syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{6}:\x\{1,4}\%(\/\d\{1,3}\)\?\>/ 78 syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{1,7}:\%(\s\|;\|$\)\@=\%(\/\d\{1,3}\)\?/ 79 80 " Identifiers 81 syn match resolvNameserver /^\s*nameserver\>/ nextgroup=resolvIPNameserver skipwhite 82 syn match resolvLwserver /^\s*lwserver\>/ nextgroup=resolvIPNameserver skipwhite 83 syn match resolvDomain /^\s*domain\>/ nextgroup=resolvHostname skipwhite 84 syn match resolvSearch /^\s*search\>/ nextgroup=resolvHostnameSearch skipwhite 85 syn match resolvSortList /^\s*sortlist\>/ nextgroup=resolvIPNetmaskSortList skipwhite 86 syn match resolvOptions /^\s*options\>/ nextgroup=resolvOption skipwhite 87 88 " Options 89 syn match resolvOption /\<\%(debug\|no_tld_query\|no-tld-query\|rotate\|no-check-names\|inet6\|ip6-bytestring\|\%(no-\)\?ip6-dotint\|edns0\|single-request\%(-reopen\)\?\|use-vc\)\>/ contained nextgroup=resolvOption skipwhite 90 syn match resolvOption /\<\%(ndots\|timeout\|attempts\):\d\+\>/ contained contains=resolvOperator nextgroup=resolvOption skipwhite 91 92 " Additional errors 93 syn match resolvError /^search .\{257,}/ 94 95 hi def link resolvIP Number 96 hi def link resolvIPNetmask Number 97 hi def link resolvHostname String 98 hi def link resolvOption String 99 100 hi def link resolvIPNameserver Number 101 hi def link resolvHostnameSearch String 102 hi def link resolvIPNetmaskSortList Number 103 104 hi def link resolvNameServer Identifier 105 hi def link resolvLwserver Identifier 106 hi def link resolvDomain Identifier 107 hi def link resolvSearch Identifier 108 hi def link resolvSortList Identifier 109 hi def link resolvOptions Identifier 110 111 hi def link resolvComment Comment 112 hi def link resolvOperator Operator 113 hi def link resolvError Error 114 hi def link resolvIPError Error 115 hi def link resolvIPSpecial Special 116 117 let b:current_syntax = "resolv" 118 119 " vim: ts=8 ft=vim