Skip to content
Newer
Older
100644 115 lines (94 sloc) 3.48 KB
e5c6ef7 updated for version 7.0001
vimboss authored Jun 13, 2004
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
5 " Last change: 2004 Apr 23
6
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
10 if version < 600
11 syntax clear
12 elseif exists("b:current_syntax")
13 finish
14 endif
15
16 " shut case off
17 syn case ignore
18
19 " Head of regedit .reg files, it's REGEDIT4 on Win9#/NT
20 syn match registryHead "^REGEDIT[0-9]*$"
21
22 " Comment
23 syn match registryComment "^;.*$"
24
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
30
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
34
35 " Disk
36 " syn match registryDisk "[a-zA-Z]:\\\\"
37
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 "-"
47
48 " String
49 syn match registryString "\".*\"" contains=registryGUID,registrySpecial
50
51 " Path
52 syn region registryPath start="\[" end="\]" contains=registryHKEY,registryGUID,registrySpecial
53
54 " Path to remove
55 " like preceding path but with a "-" at begin
56 syn region registryRemove start="\[\-" end="\]" contains=registryHKEY,registryGUID,registrySpecial
57
58 " Subkey
59 syn match registrySubKey "^\".*\"="
60 " Default value
61 syn match registrySubKey "^\@="
62
63 " Numbers
64
65 " Hex or Binary
66 " The format can be precised between () :
67 " 0 REG_NONE
68 " 1 REG_SZ
69 " 2 REG_EXPAND_SZ
70 " 3 REG_BINARY
71 " 4 REG_DWORD, REG_DWORD_LITTLE_ENDIAN
72 " 5 REG_DWORD_BIG_ENDIAN
73 " 6 REG_LINK
74 " 7 REG_MULTI_SZ
75 " 8 REG_RESOURCE_LIST
76 " 9 REG_FULL_RESOURCE_DESCRIPTOR
77 " 10 REG_RESOURCE_REQUIREMENTS_LIST
78 " The value can take several lines, if \ ends the line
79 " The limit to 999 matches is arbitrary, it avoids Vim crashing on a very long
80 " line of hex values that ends in a comma.
81 "syn match registryHex "hex\(([0-9]\{0,2})\)\=:\([0-9a-fA-F]\{2},\)\{0,999}\([0-9a-fA-F]\{2}\|\\\)$" contains=registrySpecial
82 syn match registryHex "hex\(([0-9]\{0,2})\)\=:\([0-9a-fA-F]\{2},\)*\([0-9a-fA-F]\{2}\|\\\)$" contains=registrySpecial
83 syn match registryHex "^\s*\([0-9a-fA-F]\{2},\)\{0,999}\([0-9a-fA-F]\{2}\|\\\)$" contains=registrySpecial
84 " Dword (32 bits)
85 syn match registryDword "dword:[0-9a-fA-F]\{8}$" contains=registrySpecial
86
87 if version >= 508 || !exists("did_registry_syntax_inits")
88 if version < 508
89 let did_registry_syntax_inits = 1
90 command -nargs=+ HiLink hi link <args>
91 else
92 command -nargs=+ HiLink hi def link <args>
93 endif
94
95 " The default methods for highlighting. Can be overridden later
96 HiLink registryComment Comment
97 HiLink registryHead Constant
98 HiLink registryHKEY Constant
99 HiLink registryPath Special
100 HiLink registryRemove PreProc
101 HiLink registryGUID Identifier
102 HiLink registrySpecial Special
103 HiLink registrySubKey Type
104 HiLink registryString String
105 HiLink registryHex Number
106 HiLink registryDword Number
107
108 delcommand HiLink
109 endif
110
111
112 let b:current_syntax = "registry"
113
114 " vim:ts=8
Something went wrong with that request. Please try again.