1" Vim syntax file
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
5
6" For version 5.x: Clear all syntax items
7" For version 6.x: Quit when a syntax file was already loaded
8if version < 600
9  syntax clear
10elseif exists("b:current_syntax")
11  finish
12endif
13
14syn case ignore
15
16
17"COMMENTS
18syn keyword nsisTodo	todo attention note fixme readme
19syn region nsisComment	start=";"  end="$" contains=nsisTodo
20syn region nsisComment	start="#"  end="$" contains=nsisTodo
21
22"LABELS
23syn match nsisLocalLabel	"\a\S\{-}:"
24syn match nsisGlobalLabel	"\.\S\{-1,}:"
25
26"PREPROCESSOR
27syn match nsisPreprocSubst	"${.\{-}}"
28syn match nsisDefine		"!define\>"
29syn match nsisDefine		"!undef\>"
30syn match nsisPreCondit		"!ifdef\>"
31syn match nsisPreCondit		"!ifndef\>"
32syn match nsisPreCondit		"!endif\>"
33syn match nsisPreCondit		"!else\>"
34syn match nsisMacro		"!macro\>"
35syn match nsisMacro		"!macroend\>"
36syn match nsisMacro		"!insertmacro\>"
37
38"COMPILER UTILITY
39syn match nsisInclude		"!include\>"
40syn match nsisSystem		"!cd\>"
41syn match nsisSystem		"!system\>"
42syn match nsisSystem		"!packhdr\>"
43
44"VARIABLES
45syn match nsisUserVar		"$\d"
46syn match nsisUserVar		"$R\d"
47syn match nsisSysVar		"$INSTDIR"
48syn match nsisSysVar		"$OUTDIR"
49syn match nsisSysVar		"$CMDLINE"
50syn match nsisSysVar		"$PROGRAMFILES"
51syn match nsisSysVar		"$DESKTOP"
52syn match nsisSysVar		"$EXEDIR"
53syn match nsisSysVar		"$WINDIR"
54syn match nsisSysVar		"$SYSDIR"
55syn match nsisSysVar		"$TEMP"
56syn match nsisSysVar		"$STARTMENU"
57syn match nsisSysVar		"$SMPROGRAMS"
58syn match nsisSysVar		"$SMSTARTUP"
59syn match nsisSysVar		"$QUICKLAUNCH"
60syn match nsisSysVar		"$HWNDPARENT"
61syn match nsisSysVar		"$\\r"
62syn match nsisSysVar		"$\\n"
63syn match nsisSysVar		"$\$"
64
65"STRINGS
66syn region nsisString	start=/"/ skip=/'\|`/ end=/"/ contains=nsisPreprocSubst,nsisUserVar,nsisSysVar,nsisRegistry
67syn region nsisString	start=/'/ skip=/"\|`/ end=/'/ contains=nsisPreprocSubst,nsisUserVar,nsisSysVar,nsisRegistry
68syn region nsisString	start=/`/ skip=/"\|'/ end=/`/ contains=nsisPreprocSubst,nsisUserVar,nsisSysVar,nsisRegistry
69
70"CONSTANTS
71syn keyword nsisBoolean		true false on off
72
73syn keyword nsisAttribOptions	hide show nevershow auto force try ifnewer normal silent silentlog
74syn keyword nsisAttribOptions	smooth colored SET CUR END RO none listonly textonly both current all
75syn keyword nsisAttribOptions	zlib bzip2 lzma
76
77syn match nsisAttribOptions	'\/NOCUSTOM'
78syn match nsisAttribOptions	'\/CUSTOMSTRING'
79syn match nsisAttribOptions	'\/COMPONENTSONLYONCUSTOM'
80syn match nsisAttribOptions	'\/windows'
81syn match nsisAttribOptions	'\/r'
82syn match nsisAttribOptions	'\/oname'
83syn match nsisAttribOptions	'\/REBOOTOK'
84syn match nsisAttribOptions	'\/SILENT'
85syn match nsisAttribOptions	'\/FILESONLY'
86syn match nsisAttribOptions	'\/SHORT'
87
88syn keyword nsisExecShell	SW_SHOWNORMAL SW_SHOWMAXIMIZED SW_SHOWMINIMIZED
89
90syn keyword nsisRegistry	HKCR HKLM HKCU HKU HKCC HKDD HKPD
91syn keyword nsisRegistry	HKEY_CLASSES_ROOT HKEY_LOCAL_MACHINE HKEY_CURRENT_USER HKEY_USERS
92syn keyword nsisRegistry	HKEY_CURRENT_CONFIG HKEY_DYN_DATA HKEY_PERFORMANCE_DATA
93
94syn keyword nsisFileAttrib	NORMAL ARCHIVE HIDDEN OFFLINE READONLY SYSTEM TEMPORARY
95syn keyword nsisFileAttrib	FILE_ATTRIBUTE_NORMAL FILE_ATTRIBUTE_ARCHIVE FILE_ATTRIBUTE_HIDDEN
96syn keyword nsisFileAttrib	FILE_ATTRIBUTE_OFFLINE FILE_ATTRIBUTE_READONLY FILE_ATTRIBUTE_SYSTEM
97syn keyword nsisFileAttrib	FILE_ATTRIBUTE_TEMPORARY
98
99syn keyword nsisMessageBox	MB_OK MB_OKCANCEL MB_ABORTRETRYIGNORE MB_RETRYCANCEL MB_YESNO MB_YESNOCANCEL
100syn keyword nsisMessageBox	MB_ICONEXCLAMATION MB_ICONINFORMATION MB_ICONQUESTION MB_ICONSTOP
101syn keyword nsisMessageBox	MB_TOPMOST MB_SETFOREGROUND MB_RIGHT
102syn keyword nsisMessageBox	MB_DEFBUTTON1 MB_DEFBUTTON2 MB_DEFBUTTON3 MB_DEFBUTTON4
103syn keyword nsisMessageBox	IDABORT IDCANCEL IDIGNORE IDNO IDOK IDRETRY IDYES
104
105syn match nsisNumber		"\<[^0]\d*\>"
106syn match nsisNumber		"\<0x\x\+\>"
107syn match nsisNumber		"\<0\o*\>"
108
109
110"INSTALLER ATTRIBUTES - General installer configuration
111syn keyword nsisAttribute	OutFile Name Caption SubCaption BrandingText Icon
112syn keyword nsisAttribute	WindowIcon BGGradient SilentInstall SilentUnInstall
113syn keyword nsisAttribute	CRCCheck MiscButtonText InstallButtonText FileErrorText
114
115"INSTALLER ATTRIBUTES - Install directory configuration
116syn keyword nsisAttribute	InstallDir InstallDirRegKey
117
118"INSTALLER ATTRIBUTES - License page configuration
119syn keyword nsisAttribute	LicenseText LicenseData
120
121"INSTALLER ATTRIBUTES - Component page configuration
122syn keyword nsisAttribute	ComponentText InstType EnabledBitmap DisabledBitmap SpaceTexts
123
124"INSTALLER ATTRIBUTES - Directory page configuration
125syn keyword nsisAttribute	DirShow DirText AllowRootDirInstall
126
127"INSTALLER ATTRIBUTES - Install page configuration
128syn keyword nsisAttribute	InstallColors InstProgressFlags AutoCloseWindow
129syn keyword nsisAttribute	ShowInstDetails DetailsButtonText CompletedText
130
131"INSTALLER ATTRIBUTES - Uninstall configuration
132syn keyword nsisAttribute	UninstallText UninstallIcon UninstallCaption
133syn keyword nsisAttribute	UninstallSubCaption ShowUninstDetails UninstallButtonText
134
135"COMPILER ATTRIBUTES
136syn keyword nsisCompiler	SetOverwrite SetCompress SetCompressor SetDatablockOptimize SetDateSave
137
138
139"FUNCTIONS - general purpose
140syn keyword nsisInstruction	SetOutPath File Exec ExecWait ExecShell
141syn keyword nsisInstruction	Rename Delete RMDir
142
143"FUNCTIONS - registry & ini
144syn keyword nsisInstruction	WriteRegStr WriteRegExpandStr WriteRegDWORD WriteRegBin
145syn keyword nsisInstruction	WriteINIStr ReadRegStr ReadRegDWORD ReadINIStr ReadEnvStr
146syn keyword nsisInstruction	ExpandEnvStrings DeleteRegValue DeleteRegKey EnumRegKey
147syn keyword nsisInstruction	EnumRegValue DeleteINISec DeleteINIStr
148
149"FUNCTIONS - general purpose, advanced
150syn keyword nsisInstruction	CreateDirectory CopyFiles SetFileAttributes CreateShortCut
151syn keyword nsisInstruction	GetFullPathName SearchPath GetTempFileName CallInstDLL
152syn keyword nsisInstruction	RegDLL UnRegDLL GetDLLVersion GetDLLVersionLocal
153syn keyword nsisInstruction	GetFileTime GetFileTimeLocal
154
155"FUNCTIONS - Branching, flow control, error checking, user interaction, etc instructions
156syn keyword nsisInstruction	Goto Call Return IfErrors ClearErrors SetErrors FindWindow
157syn keyword nsisInstruction	SendMessage IsWindow IfFileExists MessageBox StrCmp
158syn keyword nsisInstruction	IntCmp IntCmpU Abort Quit GetFunctionAddress GetLabelAddress
159syn keyword nsisInstruction	GetCurrentAddress
160
161"FUNCTIONS - File and directory i/o instructions
162syn keyword nsisInstruction	FindFirst FindNext FindClose FileOpen FileClose FileRead
163syn keyword nsisInstruction	FileWrite FileReadByte FileWriteByte FileSeek
164
165"FUNCTIONS - Misc instructions
166syn keyword nsisInstruction	SetDetailsView SetDetailsPrint SetAutoClose DetailPrint
167syn keyword nsisInstruction	Sleep BringToFront HideWindow SetShellVarContext
168
169"FUNCTIONS - String manipulation support
170syn keyword nsisInstruction	StrCpy StrLen
171
172"FUNCTIONS - Stack support
173syn keyword nsisInstruction	Push Pop Exch
174
175"FUNCTIONS - Integer manipulation support
176syn keyword nsisInstruction	IntOp IntFmt
177
178"FUNCTIONS - Rebooting support
179syn keyword nsisInstruction	Reboot IfRebootFlag SetRebootFlag
180
181"FUNCTIONS - Uninstaller instructions
182syn keyword nsisInstruction	WriteUninstaller
183
184"FUNCTIONS - Install logging instructions
185syn keyword nsisInstruction	LogSet LogText
186
187"FUNCTIONS - Section management instructions
188syn keyword nsisInstruction	SectionSetFlags SectionGetFlags SectionSetText
189syn keyword nsisInstruction	SectionGetText
190
191
192"SPECIAL FUNCTIONS - install
193syn match nsisCallback		"\.onInit"
194syn match nsisCallback		"\.onUserAbort"
195syn match nsisCallback		"\.onInstSuccess"
196syn match nsisCallback		"\.onInstFailed"
197syn match nsisCallback		"\.onVerifyInstDir"
198syn match nsisCallback		"\.onNextPage"
199syn match nsisCallback		"\.onPrevPage"
200syn match nsisCallback		"\.onSelChange"
201
202"SPECIAL FUNCTIONS - uninstall
203syn match nsisCallback		"un\.onInit"
204syn match nsisCallback		"un\.onUserAbort"
205syn match nsisCallback		"un\.onInstSuccess"
206syn match nsisCallback		"un\.onInstFailed"
207syn match nsisCallback		"un\.onVerifyInstDir"
208syn match nsisCallback		"un\.onNextPage"
209
210
211"STATEMENTS - sections
212syn keyword nsisStatement	Section SectionIn SectionEnd SectionDivider
213syn keyword nsisStatement	AddSize
214
215"STATEMENTS - functions
216syn keyword nsisStatement	Function FunctionEnd
217
218"STATEMENTS - pages
219syn keyword nsisStatement	Page UninstPage PageEx PageExEnc PageCallbacks
220
221
222"ERROR
223syn keyword nsisError		UninstallExeName
224
225
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
229if version >= 508 || !exists("did_nsis_syn_inits")
230
231  if version < 508
232    let did_nsys_syn_inits = 1
233    command -nargs=+ HiLink hi link <args>
234  else
235    command -nargs=+ HiLink hi def link <args>
236  endif
237
238
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
257  HiLink nsisTodo			Todo
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
266
267  delcommand HiLink
268endif
269
270let b:current_syntax = "nsis"
271
272