resolv.vim 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. " quit when a syntax file was already loaded
  19. if exists("b:current_syntax")
  20. finish
  21. endif
  22. " Errors, comments and operators
  23. syn match resolvError /./
  24. syn match resolvComment /\s*[#;].*$/
  25. syn match resolvOperator /[\/:]/ contained
  26. " IP
  27. syn cluster resolvIPCluster contains=resolvIPError,resolvIPSpecial
  28. syn match resolvIPError /\%(\d\{4,}\|25[6-9]\|2[6-9]\d\|[3-9]\d\{2}\)[\.0-9]*/ contained
  29. syn match resolvIPSpecial /\%(127\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\)/ contained
  30. " General
  31. syn match resolvIP contained /\%(\d\{1,4}\.\)\{3}\d\{1,4}/ contains=@resolvIPCluster
  32. syn match resolvIPNetmask contained /\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\%(\%(\d\{1,4}\.\)\{,3}\d\{1,4}\)\)\?/ contains=resolvOperator,@resolvIPCluster
  33. syn match resolvHostname contained /\w\{-}\.[-0-9A-Za-z_\.]*/
  34. " Nameserver IPv4
  35. syn match resolvIPNameserver contained /\%(\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\s\|$\)\)\+/ contains=@resolvIPCluster
  36. " Nameserver IPv6
  37. syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{6}\%(\x\{1,4}:\x\{1,4}\)\>/
  38. syn match resolvIPNameserver contained /\s\@<=::\%(\x\{1,4}:\)\{,6}\x\{1,4}\>/
  39. syn match resolvIPNameserver contained /\s\@<=::\%(\x\{1,4}:\)\{,5}\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/
  40. syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{1}:\%(\x\{1,4}:\)\{,5}\x\{1,4}\>/
  41. syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{1}:\%(\x\{1,4}:\)\{,4}\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/
  42. syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{2}:\%(\x\{1,4}:\)\{,4}\x\{1,4}\>/
  43. syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{2}:\%(\x\{1,4}:\)\{,3}\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/
  44. syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{3}:\%(\x\{1,4}:\)\{,3}\x\{1,4}\>/
  45. syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{3}:\%(\x\{1,4}:\)\{,2}\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/
  46. syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{4}:\%(\x\{1,4}:\)\{,2}\x\{1,4}\>/
  47. syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{4}:\%(\x\{1,4}:\)\{,1}\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/
  48. syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{5}:\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/
  49. syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{6}:\x\{1,4}\>/
  50. syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{1,7}:\%(\s\|;\|$\)\@=/
  51. " Search hostname
  52. syn match resolvHostnameSearch contained /\%(\%([-0-9A-Za-z_]\+\.\)*[-0-9A-Za-z_]\+\.\?\%(\s\|$\)\)\+/
  53. " Sortlist IPv4
  54. syn match resolvIPNetmaskSortList contained /\%(\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\%(\%(\d\{1,4}\.\)\{,3}\d\{1,4}\)\)\?\%(\s\|$\)\)\+/ contains=resolvOperator,@resolvIPCluster
  55. " Sortlist IPv6
  56. syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{6}\%(\x\{1,4}:\x\{1,4}\)\%(\/\d\{1,3}\)\?\>/
  57. syn match resolvIPNetmaskSortList contained /\s\@<=::\%(\x\{1,4}:\)\{,6}\x\{1,4}\%(\/\d\{1,3}\)\?\>/
  58. syn match resolvIPNetmaskSortList contained /\s\@<=::\%(\x\{1,4}:\)\{,5}\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/
  59. syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{1}:\%(\x\{1,4}:\)\{,5}\x\{1,4}\%(\/\d\{1,3}\)\?\>/
  60. syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{1}:\%(\x\{1,4}:\)\{,4}\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/
  61. syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{2}:\%(\x\{1,4}:\)\{,4}\x\{1,4}\%(\/\d\{1,3}\)\?\>/
  62. syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{2}:\%(\x\{1,4}:\)\{,3}\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/
  63. syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{3}:\%(\x\{1,4}:\)\{,3}\x\{1,4}\%(\/\d\{1,3}\)\?\>/
  64. syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{3}:\%(\x\{1,4}:\)\{,2}\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/
  65. syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{4}:\%(\x\{1,4}:\)\{,2}\x\{1,4}\%(\/\d\{1,3}\)\?\>/
  66. syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{4}:\%(\x\{1,4}:\)\{,1}\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/
  67. syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{5}:\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/
  68. syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{6}:\x\{1,4}\%(\/\d\{1,3}\)\?\>/
  69. syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{1,7}:\%(\s\|;\|$\)\@=\%(\/\d\{1,3}\)\?/
  70. " Identifiers
  71. syn match resolvNameserver /^\s*nameserver\>/ nextgroup=resolvIPNameserver skipwhite
  72. syn match resolvLwserver /^\s*lwserver\>/ nextgroup=resolvIPNameserver skipwhite
  73. syn match resolvDomain /^\s*domain\>/ nextgroup=resolvHostname skipwhite
  74. syn match resolvSearch /^\s*search\>/ nextgroup=resolvHostnameSearch skipwhite
  75. syn match resolvSortList /^\s*sortlist\>/ nextgroup=resolvIPNetmaskSortList skipwhite
  76. syn match resolvOptions /^\s*options\>/ nextgroup=resolvOption skipwhite
  77. " Options
  78. 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
  79. syn match resolvOption /\<\%(ndots\|timeout\|attempts\):\d\+\>/ contained contains=resolvOperator nextgroup=resolvOption skipwhite
  80. " Additional errors
  81. syn match resolvError /^search .\{257,}/
  82. hi def link resolvIP Number
  83. hi def link resolvIPNetmask Number
  84. hi def link resolvHostname String
  85. hi def link resolvOption String
  86. hi def link resolvIPNameserver Number
  87. hi def link resolvHostnameSearch String
  88. hi def link resolvIPNetmaskSortList Number
  89. hi def link resolvNameServer Identifier
  90. hi def link resolvLwserver Identifier
  91. hi def link resolvDomain Identifier
  92. hi def link resolvSearch Identifier
  93. hi def link resolvSortList Identifier
  94. hi def link resolvOptions Identifier
  95. hi def link resolvComment Comment
  96. hi def link resolvOperator Operator
  97. hi def link resolvError Error
  98. hi def link resolvIPError Error
  99. hi def link resolvIPSpecial Special
  100. let b:current_syntax = "resolv"
  101. " vim: ts=8 ft=vim