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