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