registry.vim 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. " Vim syntax file
  2. " Language: Windows Registry export with regedit (*.reg)
  3. " Maintainer: Dominique Stéphan (dominique@mggen.com)
  4. " URL: http://www.mggen.com/vim/syntax/registry.zip (doesn't work)
  5. " Last change: 2014 Oct 31
  6. " Included patch from Alexander A. Ulitin
  7. " clear any unwanted syntax defs
  8. " quit when a syntax file was already loaded
  9. if exists("b:current_syntax")
  10. finish
  11. endif
  12. " shut case off
  13. syn case ignore
  14. " Head of regedit .reg files, it's REGEDIT4 on Win9#/NT
  15. syn match registryHead "^REGEDIT[0-9]*\s*$\|^Windows Registry Editor Version \d*\.\d*\s*$"
  16. " Comment
  17. syn match registryComment "^;.*$"
  18. " Registry Key constant
  19. syn keyword registryHKEY HKEY_LOCAL_MACHINE HKEY_CLASSES_ROOT HKEY_CURRENT_USER
  20. syn keyword registryHKEY HKEY_USERS HKEY_CURRENT_CONFIG HKEY_DYN_DATA
  21. " Registry Key shortcuts
  22. syn keyword registryHKEY HKLM HKCR HKCU HKU HKCC HKDD
  23. " Some values often found in the registry
  24. " GUID (Global Unique IDentifier)
  25. syn match registryGUID "{[0-9A-Fa-f]\{8}\-[0-9A-Fa-f]\{4}\-[0-9A-Fa-f]\{4}\-[0-9A-Fa-f]\{4}\-[0-9A-Fa-f]\{12}}" contains=registrySpecial
  26. " Disk
  27. " syn match registryDisk "[a-zA-Z]:\\\\"
  28. " Special and Separator characters
  29. syn match registrySpecial "\\"
  30. syn match registrySpecial "\\\\"
  31. syn match registrySpecial "\\\""
  32. syn match registrySpecial "\."
  33. syn match registrySpecial ","
  34. syn match registrySpecial "\/"
  35. syn match registrySpecial ":"
  36. syn match registrySpecial "-"
  37. " String
  38. syn match registryString "\".*\"" contains=registryGUID,registrySpecial
  39. " Path
  40. syn region registryPath start="\[" end="\]" contains=registryHKEY,registryGUID,registrySpecial
  41. " Path to remove
  42. " like preceding path but with a "-" at begin
  43. syn region registryRemove start="\[\-" end="\]" contains=registryHKEY,registryGUID,registrySpecial
  44. " Subkey
  45. syn match registrySubKey "^\".*\"="
  46. " Default value
  47. syn match registrySubKey "^@="
  48. " Numbers
  49. " Hex or Binary
  50. " The format can be precised between () :
  51. " 0 REG_NONE
  52. " 1 REG_SZ
  53. " 2 REG_EXPAND_SZ
  54. " 3 REG_BINARY
  55. " 4 REG_DWORD, REG_DWORD_LITTLE_ENDIAN
  56. " 5 REG_DWORD_BIG_ENDIAN
  57. " 6 REG_LINK
  58. " 7 REG_MULTI_SZ
  59. " 8 REG_RESOURCE_LIST
  60. " 9 REG_FULL_RESOURCE_DESCRIPTOR
  61. " 10 REG_RESOURCE_REQUIREMENTS_LIST
  62. " The value can take several lines, if \ ends the line
  63. " The limit to 999 matches is arbitrary, it avoids Vim crashing on a very long
  64. " line of hex values that ends in a comma.
  65. "syn match registryHex "hex\(([0-9]\{0,2})\)\=:\([0-9a-fA-F]\{2},\)\{0,999}\([0-9a-fA-F]\{2}\|\\\)$" contains=registrySpecial
  66. syn match registryHex "hex\(([0-9]\{0,2})\)\=:\([0-9a-fA-F]\{2},\)*\([0-9a-fA-F]\{2}\|\\\)$" contains=registrySpecial
  67. syn match registryHex "^\s*\([0-9a-fA-F]\{2},\)\{0,999}\([0-9a-fA-F]\{2}\|\\\)$" contains=registrySpecial
  68. " Dword (32 bits)
  69. syn match registryDword "dword:[0-9a-fA-F]\{8}$" contains=registrySpecial
  70. " The default methods for highlighting. Can be overridden later
  71. hi def link registryComment Comment
  72. hi def link registryHead Constant
  73. hi def link registryHKEY Constant
  74. hi def link registryPath Special
  75. hi def link registryRemove PreProc
  76. hi def link registryGUID Identifier
  77. hi def link registrySpecial Special
  78. hi def link registrySubKey Type
  79. hi def link registryString String
  80. hi def link registryHex Number
  81. hi def link registryDword Number
  82. let b:current_syntax = "registry"
  83. " vim:ts=8