2 " Language: NSIS script, for version of NSIS 1.91 and later
3 " Maintainer: Alex Jakushev <Alex.Jakushev@kemek.lt>
4 " Last Change: 2004 May 12
6 " For version 5.x: Clear all syntax items
7 " For version 6.x: Quit when a syntax file was already loaded
10 elseif exists("b:current_syntax")
18 syn keyword nsisTodo todo attention note fixme readme
19 syn region nsisComment start=";" end="$" contains=nsisTodo
20 syn region nsisComment start="#" end="$" contains=nsisTodo
23 syn match nsisLocalLabel "\a\S\{-}:"
24 syn match nsisGlobalLabel "\.\S\{-1,}:"
27 syn match nsisPreprocSubst "${.\{-}}"
28 syn match nsisDefine "!define\>"
29 syn match nsisDefine "!undef\>"
30 syn match nsisPreCondit "!ifdef\>"
31 syn match nsisPreCondit "!ifndef\>"
32 syn match nsisPreCondit "!endif\>"
33 syn match nsisPreCondit "!else\>"
34 syn match nsisMacro "!macro\>"
35 syn match nsisMacro "!macroend\>"
36 syn match nsisMacro "!insertmacro\>"
39 syn match nsisInclude "!include\>"
40 syn match nsisSystem "!cd\>"
41 syn match nsisSystem "!system\>"
42 syn match nsisSystem "!packhdr\>"
45 syn match nsisUserVar "$\d"
46 syn match nsisUserVar "$R\d"
47 syn match nsisSysVar "$INSTDIR"
48 syn match nsisSysVar "$OUTDIR"
49 syn match nsisSysVar "$CMDLINE"
50 syn match nsisSysVar "$PROGRAMFILES"
51 syn match nsisSysVar "$DESKTOP"
52 syn match nsisSysVar "$EXEDIR"
53 syn match nsisSysVar "$WINDIR"
54 syn match nsisSysVar "$SYSDIR"
55 syn match nsisSysVar "$TEMP"
56 syn match nsisSysVar "$STARTMENU"
57 syn match nsisSysVar "$SMPROGRAMS"
58 syn match nsisSysVar "$SMSTARTUP"
59 syn match nsisSysVar "$QUICKLAUNCH"
60 syn match nsisSysVar "$HWNDPARENT"
61 syn match nsisSysVar "$\\r"
62 syn match nsisSysVar "$\\n"
63 syn match nsisSysVar "$\$"
66 syn region nsisString start=/"/ skip=/'\|`/ end=/"/ contains=nsisPreprocSubst,nsisUserVar,nsisSysVar,nsisRegistry
67 syn region nsisString start=/'/ skip=/"\|`/ end=/'/ contains=nsisPreprocSubst,nsisUserVar,nsisSysVar,nsisRegistry
68 syn region nsisString start=/`/ skip=/"\|'/ end=/`/ contains=nsisPreprocSubst,nsisUserVar,nsisSysVar,nsisRegistry
71 syn keyword nsisBoolean true false on off
73 syn keyword nsisAttribOptions hide show nevershow auto force try ifnewer normal silent silentlog
74 syn keyword nsisAttribOptions smooth colored SET CUR END RO none listonly textonly both current all
75 syn keyword nsisAttribOptions zlib bzip2 lzma
77 syn match nsisAttribOptions '\/NOCUSTOM'
78 syn match nsisAttribOptions '\/CUSTOMSTRING'
79 syn match nsisAttribOptions '\/COMPONENTSONLYONCUSTOM'
80 syn match nsisAttribOptions '\/windows'
81 syn match nsisAttribOptions '\/r'
82 syn match nsisAttribOptions '\/oname'
83 syn match nsisAttribOptions '\/REBOOTOK'
84 syn match nsisAttribOptions '\/SILENT'
85 syn match nsisAttribOptions '\/FILESONLY'
86 syn match nsisAttribOptions '\/SHORT'
88 syn keyword nsisExecShell SW_SHOWNORMAL SW_SHOWMAXIMIZED SW_SHOWMINIMIZED
90 syn keyword nsisRegistry HKCR HKLM HKCU HKU HKCC HKDD HKPD
91 syn keyword nsisRegistry HKEY_CLASSES_ROOT HKEY_LOCAL_MACHINE HKEY_CURRENT_USER HKEY_USERS
92 syn keyword nsisRegistry HKEY_CURRENT_CONFIG HKEY_DYN_DATA HKEY_PERFORMANCE_DATA
94 syn keyword nsisFileAttrib NORMAL ARCHIVE HIDDEN OFFLINE READONLY SYSTEM TEMPORARY
95 syn keyword nsisFileAttrib FILE_ATTRIBUTE_NORMAL FILE_ATTRIBUTE_ARCHIVE FILE_ATTRIBUTE_HIDDEN
96 syn keyword nsisFileAttrib FILE_ATTRIBUTE_OFFLINE FILE_ATTRIBUTE_READONLY FILE_ATTRIBUTE_SYSTEM
97 syn keyword nsisFileAttrib FILE_ATTRIBUTE_TEMPORARY
99 syn keyword nsisMessageBox MB_OK MB_OKCANCEL MB_ABORTRETRYIGNORE MB_RETRYCANCEL MB_YESNO MB_YESNOCANCEL
100 syn keyword nsisMessageBox MB_ICONEXCLAMATION MB_ICONINFORMATION MB_ICONQUESTION MB_ICONSTOP
101 syn keyword nsisMessageBox MB_TOPMOST MB_SETFOREGROUND MB_RIGHT
102 syn keyword nsisMessageBox MB_DEFBUTTON1 MB_DEFBUTTON2 MB_DEFBUTTON3 MB_DEFBUTTON4
103 syn keyword nsisMessageBox IDABORT IDCANCEL IDIGNORE IDNO IDOK IDRETRY IDYES
105 syn match nsisNumber "\<[^0]\d*\>"
106 syn match nsisNumber "\<0x\x\+\>"
107 syn match nsisNumber "\<0\o*\>"
110 "INSTALLER ATTRIBUTES - General installer configuration
111 syn keyword nsisAttribute OutFile Name Caption SubCaption BrandingText Icon
112 syn keyword nsisAttribute WindowIcon BGGradient SilentInstall SilentUnInstall
113 syn keyword nsisAttribute CRCCheck MiscButtonText InstallButtonText FileErrorText
115 "INSTALLER ATTRIBUTES - Install directory configuration
116 syn keyword nsisAttribute InstallDir InstallDirRegKey
118 "INSTALLER ATTRIBUTES - License page configuration
119 syn keyword nsisAttribute LicenseText LicenseData
121 "INSTALLER ATTRIBUTES - Component page configuration
122 syn keyword nsisAttribute ComponentText InstType EnabledBitmap DisabledBitmap SpaceTexts
124 "INSTALLER ATTRIBUTES - Directory page configuration
125 syn keyword nsisAttribute DirShow DirText AllowRootDirInstall
127 "INSTALLER ATTRIBUTES - Install page configuration
128 syn keyword nsisAttribute InstallColors InstProgressFlags AutoCloseWindow
129 syn keyword nsisAttribute ShowInstDetails DetailsButtonText CompletedText
131 "INSTALLER ATTRIBUTES - Uninstall configuration
132 syn keyword nsisAttribute UninstallText UninstallIcon UninstallCaption
133 syn keyword nsisAttribute UninstallSubCaption ShowUninstDetails UninstallButtonText
136 syn keyword nsisCompiler SetOverwrite SetCompress SetCompressor SetDatablockOptimize SetDateSave
139 "FUNCTIONS - general purpose
140 syn keyword nsisInstruction SetOutPath File Exec ExecWait ExecShell
141 syn keyword nsisInstruction Rename Delete RMDir
143 "FUNCTIONS - registry & ini
144 syn keyword nsisInstruction WriteRegStr WriteRegExpandStr WriteRegDWORD WriteRegBin
145 syn keyword nsisInstruction WriteINIStr ReadRegStr ReadRegDWORD ReadINIStr ReadEnvStr
146 syn keyword nsisInstruction ExpandEnvStrings DeleteRegValue DeleteRegKey EnumRegKey
147 syn keyword nsisInstruction EnumRegValue DeleteINISec DeleteINIStr
149 "FUNCTIONS - general purpose, advanced
150 syn keyword nsisInstruction CreateDirectory CopyFiles SetFileAttributes CreateShortCut
151 syn keyword nsisInstruction GetFullPathName SearchPath GetTempFileName CallInstDLL
152 syn keyword nsisInstruction RegDLL UnRegDLL GetDLLVersion GetDLLVersionLocal
153 syn keyword nsisInstruction GetFileTime GetFileTimeLocal
155 "FUNCTIONS - Branching, flow control, error checking, user interaction, etc instructions
156 syn keyword nsisInstruction Goto Call Return IfErrors ClearErrors SetErrors FindWindow
157 syn keyword nsisInstruction SendMessage IsWindow IfFileExists MessageBox StrCmp
158 syn keyword nsisInstruction IntCmp IntCmpU Abort Quit GetFunctionAddress GetLabelAddress
159 syn keyword nsisInstruction GetCurrentAddress
161 "FUNCTIONS - File and directory i/o instructions
162 syn keyword nsisInstruction FindFirst FindNext FindClose FileOpen FileClose FileRead
163 syn keyword nsisInstruction FileWrite FileReadByte FileWriteByte FileSeek
165 "FUNCTIONS - Misc instructions
166 syn keyword nsisInstruction SetDetailsView SetDetailsPrint SetAutoClose DetailPrint
167 syn keyword nsisInstruction Sleep BringToFront HideWindow SetShellVarContext
169 "FUNCTIONS - String manipulation support
170 syn keyword nsisInstruction StrCpy StrLen
172 "FUNCTIONS - Stack support
173 syn keyword nsisInstruction Push Pop Exch
175 "FUNCTIONS - Integer manipulation support
176 syn keyword nsisInstruction IntOp IntFmt
178 "FUNCTIONS - Rebooting support
179 syn keyword nsisInstruction Reboot IfRebootFlag SetRebootFlag
181 "FUNCTIONS - Uninstaller instructions
182 syn keyword nsisInstruction WriteUninstaller
184 "FUNCTIONS - Install logging instructions
185 syn keyword nsisInstruction LogSet LogText
187 "FUNCTIONS - Section management instructions
188 syn keyword nsisInstruction SectionSetFlags SectionGetFlags SectionSetText
189 syn keyword nsisInstruction SectionGetText
192 "SPECIAL FUNCTIONS - install
193 syn match nsisCallback "\.onInit"
194 syn match nsisCallback "\.onUserAbort"
195 syn match nsisCallback "\.onInstSuccess"
196 syn match nsisCallback "\.onInstFailed"
197 syn match nsisCallback "\.onVerifyInstDir"
198 syn match nsisCallback "\.onNextPage"
199 syn match nsisCallback "\.onPrevPage"
200 syn match nsisCallback "\.onSelChange"
202 "SPECIAL FUNCTIONS - uninstall
203 syn match nsisCallback "un\.onInit"
204 syn match nsisCallback "un\.onUserAbort"
205 syn match nsisCallback "un\.onInstSuccess"
206 syn match nsisCallback "un\.onInstFailed"
207 syn match nsisCallback "un\.onVerifyInstDir"
208 syn match nsisCallback "un\.onNextPage"
211 "STATEMENTS - sections
212 syn keyword nsisStatement Section SectionIn SectionEnd SectionDivider
213 syn keyword nsisStatement AddSize
215 "STATEMENTS - functions
216 syn keyword nsisStatement Function FunctionEnd
219 syn keyword nsisStatement Page UninstPage PageEx PageExEnc PageCallbacks
223 syn keyword nsisError UninstallExeName
226 " Define the default highlighting.
227 " For version 5.7 and earlier: only when not done already
228 " For version 5.8 and later: only when an item doesn't have highlighting yet
229 if version >= 508 || !exists("did_nsis_syn_inits")
232 let did_nsys_syn_inits = 1
233 command -nargs=+ HiLink hi link <args>
235 command -nargs=+ HiLink hi def link <args>
239 HiLink nsisInstruction Function
240 HiLink nsisComment Comment
241 HiLink nsisLocalLabel Label
242 HiLink nsisGlobalLabel Label
243 HiLink nsisStatement Statement
244 HiLink nsisString String
245 HiLink nsisBoolean Boolean
246 HiLink nsisAttribOptions Constant
247 HiLink nsisExecShell Constant
248 HiLink nsisFileAttrib Constant
249 HiLink nsisMessageBox Constant
250 HiLink nsisRegistry Identifier
251 HiLink nsisNumber Number
252 HiLink nsisError Error
253 HiLink nsisUserVar Identifier
254 HiLink nsisSysVar Identifier
255 HiLink nsisAttribute Type
256 HiLink nsisCompiler Type
258 HiLink nsisCallback Operator
259 " preprocessor commands
260 HiLink nsisPreprocSubst PreProc
261 HiLink nsisDefine Define
262 HiLink nsisMacro Macro
263 HiLink nsisPreCondit PreCondit
264 HiLink nsisInclude Include
265 HiLink nsisSystem PreProc
270 let b:current_syntax = "nsis"