blob: 764f94b11a9cef88983bf480cbcedba0e99526b0 [file] [log] [blame]
Bram Moolenaarb6799ac2007-05-10 16:44:05 +00001" Vim syntax file
2" Language: AutoHotkey script file
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003" Maintainer: SungHyun Nam <goweol@gmail.com>
4" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
5" Latest Revision: 2015-10-29
Bram Moolenaarb6799ac2007-05-10 16:44:05 +00006
7if exists("b:current_syntax")
8 finish
9endif
10
11let s:cpo_save = &cpo
12set cpo&vim
13
14syn case ignore
15
16syn keyword autohotkeyTodo
17 \ contained
18 \ TODO FIXME XXX NOTE
19
20syn cluster autohotkeyCommentGroup
21 \ contains=
22 \ autohotkeyTodo,
23 \ @Spell
24
25syn match autohotkeyComment
26 \ display
27 \ contains=@autohotkeyCommentGroup
28 \ '`\@<!;.*$'
29
30syn region autohotkeyComment
31 \ contains=@autohotkeyCommentGroup
32 \ matchgroup=autohotkeyCommentStart
33 \ start='/\*'
34 \ end='\*/'
35
36syn match autohotkeyEscape
37 \ display
38 \ '`.'
39
40syn match autohotkeyHotkey
41 \ contains=autohotkeyKey,
42 \ autohotkeyHotkeyDelimiter
43 \ display
44 \ '^.\{-}::'
45
46syn match autohotkeyKey
47 \ contained
48 \ display
49 \ '^.\{-}'
50
51syn match autohotkeyDelimiter
52 \ contained
53 \ display
54 \ '::'
55
56syn match autohotkeyHotstringDefinition
57 \ contains=autohotkeyHotstring,
58 \ autohotkeyHotstringDelimiter
59 \ display
60 \ '^:\%(B0\|C1\|K\d\+\|P\d\+\|S[IPE]\|Z\d\=\|[*?COR]\)*:.\{-}::'
61
62syn match autohotkeyHotstring
63 \ contained
64 \ display
65 \ '.\{-}'
66
67syn match autohotkeyHotstringDelimiter
68 \ contained
69 \ display
70 \ '::'
71
72syn match autohotkeyHotstringDelimiter
73 \ contains=autohotkeyHotstringOptions
74 \ contained
75 \ display
76 \ ':\%(B0\|C1\|K\d\+\|P\d\+\|S[IPE]\|Z\d\=\|[*?COR]\):'
77
78syn match autohotkeyHotstringOptions
79 \ contained
80 \ display
81 \ '\%(B0\|C1\|K\d\+\|P\d\+\|S[IPE]\|Z\d\=\|[*?COR]\)'
82
83syn region autohotkeyString
84 \ display
85 \ oneline
86 \ matchgroup=autohotkeyStringDelimiter
87 \ start=+"+
88 \ end=+"+
89 \ contains=autohotkeyEscape
90
91syn region autohotkeyVariable
92 \ display
93 \ oneline
94 \ contains=autohotkeyBuiltinVariable
95 \ matchgroup=autohotkeyVariableDelimiter
96 \ start="%"
97 \ end="%"
98 \ keepend
99
100syn keyword autohotkeyBuiltinVariable
101 \ A_Space A_Tab
102 \ A_WorkingDir A_ScriptDir A_ScriptName A_ScriptFullPath A_LineNumber
103 \ A_LineFile A_AhkVersion A_AhkPAth A_IsCompiled A_ExitReason
104 \ A_YYYY A_MM A_DD A_MMMM A_MMM A_DDDD A_DDD A_WDay A_YWeek A_Hour A_Min
105 \ A_Sec A_MSec A_Now A_NowUTC A_TickCount
106 \ A_IsSuspended A_BatchLines A_TitleMatchMode A_TitleMatchModeSpeed
107 \ A_DetectHiddenWindows A_DetectHiddenText A_AutoTrim A_STringCaseSense
108 \ A_FormatInteger A_FormatFloat A_KeyDelay A_WinDelay A_ControlDelay
109 \ A_MouseDelay A_DefaultMouseSpeed A_IconHidden A_IconTip A_IconFile
110 \ A_IconNumber
111 \ A_TimeIdle A_TimeIdlePhysical
112 \ A_Gui A_GuiControl A_GuiWidth A_GuiHeight A_GuiX A_GuiY A_GuiEvent
113 \ A_GuiControlEvent A_EventInfo
114 \ A_ThisMenuItem A_ThisMenu A_ThisMenuItemPos A_ThisHotkey A_PriorHotkey
115 \ A_TimeSinceThisHotkey A_TimeSincePriorHotkey A_EndChar
116 \ ComSpec A_Temp A_OSType A_OSVersion A_Language A_ComputerName A_UserName
117 \ A_WinDir A_ProgramFiles ProgramFiles A_AppData A_AppDataCommon A_Desktop
118 \ A_DesktopCommon A_StartMenu A_StartMenuCommon A_Programs
119 \ A_ProgramsCommon A_Startup A_StartupCommon A_MyDocuments A_IsAdmin
120 \ A_ScreenWidth A_ScreenHeight A_IPAddress1 A_IPAddress2 A_IPAddress3
121 \ A_IPAddress4
122 \ A_Cursor A_CaretX A_CaretY Clipboard ClipboardAll ErrorLevel A_LastError
123 \ A_Index A_LoopFileName A_LoopRegName A_LoopReadLine A_LoopField
124
125syn match autohotkeyBuiltinVariable
126 \ contained
127 \ display
128 \ '%\d\+%'
129
130syn keyword autohotkeyCommand
131 \ ClipWait EnvGet EnvSet EnvUpdate
132 \ Drive DriveGet DriveSpaceFree FileAppend FileCopy FileCopyDir
133 \ FileCreateDir FileCreateShortcut FileDelete FileGetAttrib
134 \ FileGetShortcut FileGetSize FileGetTime FileGetVersion FileInstall
135 \ FileMove FileMoveDir FileReadLine FileRead FileRecycle FileRecycleEmpty
136 \ FileRemoveDir FileSelectFolder FileSelectFile FileSetAttrib FileSetTime
137 \ IniDelete IniRead IniWrite SetWorkingDir
138 \ SplitPath
139 \ Gui GuiControl GuiControlGet IfMsgBox InputBox MsgBox Progress
140 \ SplashImage SplashTextOn SplashTextOff ToolTip TrayTip
141 \ Hotkey ListHotkeys BlockInput ControlSend ControlSendRaw GetKeyState
142 \ KeyHistory KeyWait Input Send SendRaw SendInput SendPlay SendEvent
143 \ SendMode SetKeyDelay SetNumScrollCapsLockState SetStoreCapslockMode
144 \ EnvAdd EnvDiv EnvMult EnvSub Random SetFormat Transform
145 \ AutoTrim BlockInput CoordMode Critical Edit ImageSearch
146 \ ListLines ListVars Menu OutputDebug PixelGetColor PixelSearch
147 \ SetBatchLines SetEnv SetTimer SysGet Thread Transform URLDownloadToFile
148 \ Click ControlClick MouseClick MouseClickDrag MouseGetPos MouseMove
149 \ SetDefaultMouseSpeed SetMouseDelay
150 \ Process Run RunWait RunAs Shutdown Sleep
151 \ RegDelete RegRead RegWrite
152 \ SoundBeep SoundGet SoundGetWaveVolume SoundPlay SoundSet
153 \ SoundSetWaveVolume
154 \ FormatTime IfInString IfNotInString Sort StringCaseSense StringGetPos
155 \ StringLeft StringRight StringLower StringUpper StringMid StringReplace
156 \ StringSplit StringTrimLeft StringTrimRight
157 \ Control ControlClick ControlFocus ControlGet ControlGetFocus
158 \ ControlGetPos ControlGetText ControlMove ControlSend ControlSendRaw
159 \ ControlSetText Menu PostMessage SendMessage SetControlDelay
160 \ WinMenuSelectItem GroupActivate GroupAdd GroupClose GroupDeactivate
161 \ DetectHiddenText DetectHiddenWindows SetTitleMatchMode SetWinDelay
162 \ StatusBarGetText StatusBarWait WinActivate WinActivateBottom WinClose
163 \ WinGet WinGetActiveStats WinGetActiveTitle WinGetClass WinGetPos
164 \ WinGetText WinGetTitle WinHide WinKill WinMaximize WinMinimize
165 \ WinMinimizeAll WinMinimizeAllUndo WinMove WinRestore WinSet
166 \ WinSetTitle WinShow WinWait WinWaitActive WinWaitNotActive WinWaitClose
167
168syn keyword autohotkeyFunction
169 \ InStr RegExMatch RegExReplace StrLen SubStr Asc Chr
170 \ DllCall VarSetCapacity WinActive WinExist IsLabel OnMessage
171 \ Abs Ceil Exp Floor Log Ln Mod Round Sqrt Sin Cos Tan ASin ACos ATan
172 \ FileExist GetKeyState
173
174syn keyword autohotkeyStatement
175 \ Break Continue Exit ExitApp Gosub Goto OnExit Pause Return
176 \ Suspend Reload
177
178syn keyword autohotkeyRepeat
179 \ Loop
180
181syn keyword autohotkeyConditional
182 \ IfExist IfNotExist If IfEqual IfLess IfGreater Else
Bram Moolenaara0f849e2015-10-30 14:37:44 +0100183 \ IfWinExist IfWinNotExist
Bram Moolenaarb6799ac2007-05-10 16:44:05 +0000184
185syn match autohotkeyPreProcStart
186 \ nextgroup=
187 \ autohotkeyInclude,
188 \ autohotkeyPreProc
189 \ skipwhite
190 \ display
191 \ '^\s*\zs#'
192
193syn keyword autohotkeyInclude
194 \ contained
195 \ Include
196 \ IncludeAgain
197
198syn keyword autohotkeyPreProc
199 \ contained
200 \ HotkeyInterval HotKeyModifierTimeout
201 \ Hotstring
202 \ IfWinActive IfWinNotActive IfWinExist IfWinNotExist
203 \ MaxHotkeysPerInterval MaxThreads MaxThreadsBuffer MaxThreadsPerHotkey
204 \ UseHook InstallKeybdHook InstallMouseHook
205 \ KeyHistory
206 \ NoTrayIcon SingleInstance
207 \ WinActivateForce
208 \ AllowSameLineComments
209 \ ClipboardTimeout
210 \ CommentFlag
211 \ ErrorStdOut
212 \ EscapeChar
213 \ MaxMem
214 \ NoEnv
215 \ Persistent
216
217syn keyword autohotkeyMatchClass
218 \ ahk_group ahk_class ahk_id ahk_pid
219
220syn match autohotkeyNumbers
221 \ display
222 \ transparent
223 \ contains=
224 \ autohotkeyInteger,
225 \ autohotkeyFloat
226 \ '\<\d\|\.\d'
227
228syn match autohotkeyInteger
229 \ contained
230 \ display
231 \ '\d\+\>'
232
233syn match autohotkeyInteger
234 \ contained
235 \ display
236 \ '0x\x\+\>'
237
238syn match autohotkeyFloat
239 \ contained
240 \ display
241 \ '\d\+\.\d*\|\.\d\+\>'
242
243syn keyword autohotkeyType
244 \ local
245 \ global
246
Bram Moolenaarf2330482008-06-24 20:19:36 +0000247syn keyword autohotkeyBoolean
248 \ true
249 \ false
250
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000251" TODO: Shouldn't we look for g:, b:, variables before defaulting to
252" something?
253if exists("g:autohotkey_syntax_sync_minlines")
254 let b:autohotkey_syntax_sync_minlines = g:autohotkey_syntax_sync_minlines
255else
256 let b:autohotkey_syntax_sync_minlines = 50
257endif
258exec "syn sync ccomment autohotkeyComment minlines=" . b:autohotkey_syntax_sync_minlines
259
Bram Moolenaarb6799ac2007-05-10 16:44:05 +0000260hi def link autohotkeyTodo Todo
261hi def link autohotkeyComment Comment
262hi def link autohotkeyCommentStart autohotkeyComment
263hi def link autohotkeyEscape Special
264hi def link autohotkeyHotkey Type
265hi def link autohotkeyKey Type
266hi def link autohotkeyDelimiter Delimiter
267hi def link autohotkeyHotstringDefinition Type
268hi def link autohotkeyHotstring Type
269hi def link autohotkeyHotstringDelimiter autohotkeyDelimiter
270hi def link autohotkeyHotstringOptions Special
271hi def link autohotkeyString String
272hi def link autohotkeyStringDelimiter autohotkeyString
273hi def link autohotkeyVariable Identifier
274hi def link autohotkeyVariableDelimiter autohotkeyVariable
275hi def link autohotkeyBuiltinVariable Macro
276hi def link autohotkeyCommand Keyword
277hi def link autohotkeyFunction Function
278hi def link autohotkeyStatement autohotkeyCommand
279hi def link autohotkeyRepeat Repeat
280hi def link autohotkeyConditional Conditional
281hi def link autohotkeyPreProcStart PreProc
282hi def link autohotkeyInclude Include
283hi def link autohotkeyPreProc PreProc
284hi def link autohotkeyMatchClass Typedef
285hi def link autohotkeyNumber Number
286hi def link autohotkeyInteger autohotkeyNumber
287hi def link autohotkeyFloat autohotkeyNumber
288hi def link autohotkeyType Type
Bram Moolenaarf2330482008-06-24 20:19:36 +0000289hi def link autohotkeyBoolean Boolean
Bram Moolenaarb6799ac2007-05-10 16:44:05 +0000290
291let b:current_syntax = "autohotkey"
292
293let &cpo = s:cpo_save
294unlet s:cpo_save