2 " Language: Windows Registry export with regedit (*.reg)
3 " Maintainer: Dominique Stéphan (stephan@my-deja.com)
4 " URL: http://www.mggen.com/vim/syntax/registry.zip
5 " Last change: 2001 May 10
7 " clear any unwanted syntax defs
8 " For version 5.x: Clear all syntax items
9 " For version 6.x: Quit when a syntax file was already loaded
12 elseif exists("b:current_syntax")
19 " Head of regedit .reg files, it's REGEDIT4 on Win9#/NT
20 syn match registryHead "^REGEDIT[0-9]*$"
23 syn match registryComment "^;.*$"
25 " Registry Key constant
26 syn keyword registryHKEY HKEY_LOCAL_MACHINE HKEY_CLASSES_ROOT HKEY_CURRENT_USER
27 syn keyword registryHKEY HKEY_USERS HKEY_CURRENT_CONFIG HKEY_DYN_DATA
28 " Registry Key shortcuts
29 syn keyword registryHKEY HKLM HKCR HKCU HKU HKCC HKDD
31 " Some values often found in the registry
32 " GUID (Global Unique IDentifier)
33 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
36 " syn match registryDisk "[a-zA-Z]:\\\\"
38 " Special and Separator characters
39 syn match registrySpecial "\\"
40 syn match registrySpecial "\\\\"
41 syn match registrySpecial "\\\""
42 syn match registrySpecial "\."
43 syn match registrySpecial ","
44 syn match registrySpecial "\/"
45 syn match registrySpecial ":"
46 syn match registrySpecial "-"
49 syn match registryString "\".*\"" contains=registryGUID,registrySpecial
52 syn region registryPath start="\[" end="\]" contains=registryHKEY,registryGUID,registrySpecial
55 " like preceding path but with a "-" at begin
56 syn region registryRemove start="\[\-" end="\]" contains=registryHKEY,registryGUID,registrySpecial
59 syn match registrySubKey "^\".*\"="
61 syn match registrySubKey "^\@="
66 " The format can be precised between () :
71 " 4 REG_DWORD, REG_DWORD_LITTLE_ENDIAN
72 " 5 REG_DWORD_BIG_ENDIAN
76 " 9 REG_FULL_RESOURCE_DESCRIPTOR
77 " 10 REG_RESOURCE_REQUIREMENTS_LIST
78 " The value can take several lines, if \ ends the line
79 syn match registryHex "hex\(([0-9]\{0,2})\)\=:\([0-9a-fA-F]\{2},\)*\([0-9a-fA-F]\{2}\|\\\)$" contains=registrySpecial
80 syn match registryHex "^\s*\([0-9a-fA-F]\{2},\)*\([0-9a-fA-F]\{2}\|\\\)$" contains=registrySpecial
82 syn match registryDword "dword:[0-9a-fA-F]\{8}$" contains=registrySpecial
84 if version >= 508 || !exists("did_registry_syntax_inits")
86 let did_registry_syntax_inits = 1
87 command -nargs=+ HiLink hi link <args>
89 command -nargs=+ HiLink hi def link <args>
92 " The default methods for highlighting. Can be overridden later
93 HiLink registryComment Comment
94 HiLink registryHead Constant
95 HiLink registryHKEY Constant
96 HiLink registryPath Special
97 HiLink registryRemove PreProc
98 HiLink registryGUID Identifier
99 HiLink registrySpecial Special
100 HiLink registrySubKey Type
101 HiLink registryString String
102 HiLink registryHex Number
103 HiLink registryDword Number
109 let b:current_syntax = "registry"