1187
|
1 " Vim syntax file
|
|
2 " Language: AutoHotkey script file
|
10734
|
3 " Maintainer: Michael Wong
|
|
4 " https://github.com/mmikeww/autohotkey.vim
|
29533
|
5 " Latest Revision: 2022-07-25
|
10734
|
6 " Previous Maintainers: SungHyun Nam <goweol@gmail.com>
|
|
7 " Nikolai Weibull <now@bitwi.se>
|
1187
|
8
|
|
9 if exists("b:current_syntax")
|
|
10 finish
|
|
11 endif
|
|
12
|
|
13 let s:cpo_save = &cpo
|
|
14 set cpo&vim
|
|
15
|
|
16 syn case ignore
|
|
17
|
|
18 syn keyword autohotkeyTodo
|
|
19 \ contained
|
|
20 \ TODO FIXME XXX NOTE
|
|
21
|
10734
|
22 " only these chars are valid as escape sequences: ,%`;nrbtvaf
|
|
23 " https://autohotkey.com/docs/commands/_EscapeChar.htm
|
1187
|
24 syn match autohotkeyEscape
|
|
25 \ display
|
10734
|
26 \ '`[,%`;nrbtvaf]'
|
1187
|
27
|
|
28 syn region autohotkeyString
|
|
29 \ display
|
|
30 \ oneline
|
|
31 \ matchgroup=autohotkeyStringDelimiter
|
|
32 \ start=+"+
|
|
33 \ end=+"+
|
29533
|
34 \ contains=autohotkeyEscape,autohotkeyMatchClass
|
1187
|
35
|
10734
|
36 syn match autohotkeyVariable
|
1187
|
37 \ display
|
|
38 \ oneline
|
|
39 \ contains=autohotkeyBuiltinVariable
|
|
40 \ keepend
|
10734
|
41 \ '%\S\{-}%'
|
1187
|
42
|
|
43 syn keyword autohotkeyBuiltinVariable
|
|
44 \ A_Space A_Tab
|
10734
|
45 \ A_WorkingDir A_ScriptDir A_ScriptName A_ScriptFullPath A_ScriptHwnd A_LineNumber
|
|
46 \ A_LineFile A_ThisFunc A_ThisLabel A_AhkVersion A_AhkPath A_IsUnicode A_IsCompiled A_ExitReason
|
|
47 \ A_YYYY A_MM A_DD A_MMMM A_MMM A_DDDD A_DDD A_WDay A_YDay A_YWeek A_Hour A_Min
|
|
48 \ A_Mon A_Year A_MDay A_NumBatchLines
|
1187
|
49 \ A_Sec A_MSec A_Now A_NowUTC A_TickCount
|
10734
|
50 \ A_IsSuspended A_IsPaused A_IsCritical A_BatchLines A_TitleMatchMode A_TitleMatchModeSpeed
|
|
51 \ A_DetectHiddenWindows A_DetectHiddenText A_AutoTrim A_StringCaseSense
|
29533
|
52 \ A_FileEncoding A_FormatInteger A_FormatFloat A_WinDelay A_ControlDelay
|
|
53 \ A_SendMode A_SendLevel A_StoreCapsLockMode A_KeyDelay A_KeyDuration
|
|
54 \ A_KeyDelayPlay A_KeyDurationPlay A_MouseDelayPlay
|
10734
|
55 \ A_MouseDelay A_DefaultMouseSpeed A_RegView A_IconHidden A_IconTip A_IconFile
|
|
56 \ A_CoordModeToolTip A_CoordModePixel A_CoordModeMouse A_CoordModeCaret A_CoordModeMenu
|
1187
|
57 \ A_IconNumber
|
10734
|
58 \ A_TimeIdle A_TimeIdlePhysical A_DefaultGui A_DefaultListView A_DefaultTreeView
|
1187
|
59 \ A_Gui A_GuiControl A_GuiWidth A_GuiHeight A_GuiX A_GuiY A_GuiEvent
|
|
60 \ A_GuiControlEvent A_EventInfo
|
|
61 \ A_ThisMenuItem A_ThisMenu A_ThisMenuItemPos A_ThisHotkey A_PriorHotkey
|
10734
|
62 \ A_PriorKey A_TimeSinceThisHotkey A_TimeSincePriorHotkey A_EndChar
|
1187
|
63 \ ComSpec A_Temp A_OSType A_OSVersion A_Language A_ComputerName A_UserName
|
10734
|
64 \ A_Is64BitOS A_PtrSize
|
1187
|
65 \ A_WinDir A_ProgramFiles ProgramFiles A_AppData A_AppDataCommon A_Desktop
|
|
66 \ A_DesktopCommon A_StartMenu A_StartMenuCommon A_Programs
|
|
67 \ A_ProgramsCommon A_Startup A_StartupCommon A_MyDocuments A_IsAdmin
|
10734
|
68 \ A_ScreenWidth A_ScreenHeight A_ScreenDPI A_IPAddress1 A_IPAddress2 A_IPAddress3
|
1187
|
69 \ A_IPAddress4
|
|
70 \ A_Cursor A_CaretX A_CaretY Clipboard ClipboardAll ErrorLevel A_LastError
|
|
71 \ A_Index A_LoopFileName A_LoopRegName A_LoopReadLine A_LoopField
|
10734
|
72 \ A_LoopFileExt A_LoopFileFullPath A_LoopFileLongPath A_LoopFileShortPath
|
|
73 \ A_LoopFileShortName A_LoopFileDir A_LoopFileTimeModified A_LoopFileTimeCreated
|
|
74 \ A_LoopFileTimeAccessed A_LoopFileAttrib A_LoopFileSize A_LoopFileSizeKB A_LoopFileSizeMB
|
|
75 \ A_LoopRegType A_LoopRegKey A_LoopRegSubKey A_LoopRegTimeModified
|
29533
|
76 \ A_TimeIdleKeyboard A_TimeIdleMouse A_ListLines A_ComSpec A_LoopFilePath A_Args
|
1187
|
77
|
|
78 syn match autohotkeyBuiltinVariable
|
|
79 \ contained
|
|
80 \ display
|
|
81 \ '%\d\+%'
|
|
82
|
|
83 syn keyword autohotkeyCommand
|
|
84 \ ClipWait EnvGet EnvSet EnvUpdate
|
|
85 \ Drive DriveGet DriveSpaceFree FileAppend FileCopy FileCopyDir
|
10734
|
86 \ FileCreateDir FileCreateShortcut FileDelete FileGetAttrib FileEncoding
|
1187
|
87 \ FileGetShortcut FileGetSize FileGetTime FileGetVersion FileInstall
|
|
88 \ FileMove FileMoveDir FileReadLine FileRead FileRecycle FileRecycleEmpty
|
|
89 \ FileRemoveDir FileSelectFolder FileSelectFile FileSetAttrib FileSetTime
|
|
90 \ IniDelete IniRead IniWrite SetWorkingDir
|
|
91 \ SplitPath
|
|
92 \ Gui GuiControl GuiControlGet IfMsgBox InputBox MsgBox Progress
|
|
93 \ SplashImage SplashTextOn SplashTextOff ToolTip TrayTip
|
|
94 \ Hotkey ListHotkeys BlockInput ControlSend ControlSendRaw GetKeyState
|
|
95 \ KeyHistory KeyWait Input Send SendRaw SendInput SendPlay SendEvent
|
|
96 \ SendMode SetKeyDelay SetNumScrollCapsLockState SetStoreCapslockMode
|
|
97 \ EnvAdd EnvDiv EnvMult EnvSub Random SetFormat Transform
|
|
98 \ AutoTrim BlockInput CoordMode Critical Edit ImageSearch
|
|
99 \ ListLines ListVars Menu OutputDebug PixelGetColor PixelSearch
|
|
100 \ SetBatchLines SetEnv SetTimer SysGet Thread Transform URLDownloadToFile
|
|
101 \ Click ControlClick MouseClick MouseClickDrag MouseGetPos MouseMove
|
|
102 \ SetDefaultMouseSpeed SetMouseDelay
|
|
103 \ Process Run RunWait RunAs Shutdown Sleep
|
|
104 \ RegDelete RegRead RegWrite
|
|
105 \ SoundBeep SoundGet SoundGetWaveVolume SoundPlay SoundSet
|
|
106 \ SoundSetWaveVolume
|
|
107 \ FormatTime IfInString IfNotInString Sort StringCaseSense StringGetPos
|
|
108 \ StringLeft StringRight StringLower StringUpper StringMid StringReplace
|
10734
|
109 \ StringSplit StringTrimLeft StringTrimRight StringLen
|
11347
|
110 \ StrSplit StrReplace Throw
|
1187
|
111 \ Control ControlClick ControlFocus ControlGet ControlGetFocus
|
|
112 \ ControlGetPos ControlGetText ControlMove ControlSend ControlSendRaw
|
|
113 \ ControlSetText Menu PostMessage SendMessage SetControlDelay
|
|
114 \ WinMenuSelectItem GroupActivate GroupAdd GroupClose GroupDeactivate
|
|
115 \ DetectHiddenText DetectHiddenWindows SetTitleMatchMode SetWinDelay
|
|
116 \ StatusBarGetText StatusBarWait WinActivate WinActivateBottom WinClose
|
|
117 \ WinGet WinGetActiveStats WinGetActiveTitle WinGetClass WinGetPos
|
|
118 \ WinGetText WinGetTitle WinHide WinKill WinMaximize WinMinimize
|
|
119 \ WinMinimizeAll WinMinimizeAllUndo WinMove WinRestore WinSet
|
|
120 \ WinSetTitle WinShow WinWait WinWaitActive WinWaitNotActive WinWaitClose
|
10734
|
121 \ SetCapsLockState SetNumLockState SetScrollLockState
|
29533
|
122 \ Hotstring LoadPicture MenuGetHandle MenuGetName OnError OnClipboardChange
|
1187
|
123
|
|
124 syn keyword autohotkeyFunction
|
11347
|
125 \ InStr RegExMatch RegExReplace StrLen SubStr Asc Chr Func
|
1187
|
126 \ DllCall VarSetCapacity WinActive WinExist IsLabel OnMessage
|
|
127 \ Abs Ceil Exp Floor Log Ln Mod Round Sqrt Sin Cos Tan ASin ACos ATan
|
10734
|
128 \ FileExist GetKeyState NumGet NumPut StrGet StrPut RegisterCallback
|
|
129 \ IsFunc Trim LTrim RTrim IsObject Object Array FileOpen
|
|
130 \ ComObjActive ComObjArray ComObjConnect ComObjCreate ComObjGet
|
|
131 \ ComObjError ComObjFlags ComObjQuery ComObjType ComObjValue ComObject
|
29533
|
132 \ Format Exception Ord InputHook
|
1187
|
133
|
|
134 syn keyword autohotkeyStatement
|
|
135 \ Break Continue Exit ExitApp Gosub Goto OnExit Pause Return
|
11347
|
136 \ Suspend Reload new class extends
|
1187
|
137
|
|
138 syn keyword autohotkeyRepeat
|
|
139 \ Loop
|
|
140
|
|
141 syn keyword autohotkeyConditional
|
|
142 \ IfExist IfNotExist If IfEqual IfLess IfGreater Else
|
10734
|
143 \ IfWinExist IfWinNotExist IfWinActive IfWinNotActive
|
|
144 \ IfNotEqual IfLessOrEqual IfGreaterOrEqual
|
29533
|
145 \ while until for in try catch finally not
|
|
146 \ switch case default
|
1187
|
147
|
|
148 syn match autohotkeyPreProcStart
|
|
149 \ nextgroup=
|
|
150 \ autohotkeyInclude,
|
|
151 \ autohotkeyPreProc
|
|
152 \ skipwhite
|
|
153 \ display
|
|
154 \ '^\s*\zs#'
|
|
155
|
|
156 syn keyword autohotkeyInclude
|
|
157 \ contained
|
|
158 \ Include
|
|
159 \ IncludeAgain
|
|
160
|
|
161 syn keyword autohotkeyPreProc
|
|
162 \ contained
|
|
163 \ HotkeyInterval HotKeyModifierTimeout
|
|
164 \ Hotstring
|
|
165 \ IfWinActive IfWinNotActive IfWinExist IfWinNotExist
|
10734
|
166 \ If IfTimeout
|
1187
|
167 \ MaxHotkeysPerInterval MaxThreads MaxThreadsBuffer MaxThreadsPerHotkey
|
|
168 \ UseHook InstallKeybdHook InstallMouseHook
|
|
169 \ KeyHistory
|
|
170 \ NoTrayIcon SingleInstance
|
|
171 \ WinActivateForce
|
|
172 \ AllowSameLineComments
|
|
173 \ ClipboardTimeout
|
|
174 \ CommentFlag
|
|
175 \ ErrorStdOut
|
|
176 \ EscapeChar
|
|
177 \ MaxMem
|
|
178 \ NoEnv
|
|
179 \ Persistent
|
10734
|
180 \ LTrim
|
|
181 \ InputLevel
|
|
182 \ MenuMaskKey
|
|
183 \ Warn
|
1187
|
184
|
|
185 syn keyword autohotkeyMatchClass
|
11347
|
186 \ ahk_group ahk_class ahk_id ahk_pid ahk_exe
|
1187
|
187
|
|
188 syn match autohotkeyNumbers
|
|
189 \ display
|
|
190 \ transparent
|
|
191 \ contains=
|
|
192 \ autohotkeyInteger,
|
|
193 \ autohotkeyFloat
|
|
194 \ '\<\d\|\.\d'
|
|
195
|
|
196 syn match autohotkeyInteger
|
|
197 \ contained
|
|
198 \ display
|
|
199 \ '\d\+\>'
|
|
200
|
|
201 syn match autohotkeyInteger
|
|
202 \ contained
|
|
203 \ display
|
|
204 \ '0x\x\+\>'
|
|
205
|
|
206 syn match autohotkeyFloat
|
|
207 \ contained
|
|
208 \ display
|
|
209 \ '\d\+\.\d*\|\.\d\+\>'
|
|
210
|
|
211 syn keyword autohotkeyType
|
|
212 \ local
|
|
213 \ global
|
10734
|
214 \ static
|
|
215 \ byref
|
1187
|
216
|
1618
|
217 syn keyword autohotkeyBoolean
|
|
218 \ true
|
|
219 \ false
|
|
220
|
10734
|
221 syn match autohotkeyHotkey
|
|
222 \ contains=autohotkeyKey,
|
|
223 \ autohotkeyHotkeyDelimiter
|
|
224 \ display
|
11347
|
225 \ '^\s*\S*\%( Up\)\?::'
|
10734
|
226
|
|
227 syn match autohotkeyKey
|
|
228 \ contained
|
|
229 \ display
|
|
230 \ '^.\{-}'
|
|
231
|
|
232 syn match autohotkeyDelimiter
|
|
233 \ contained
|
|
234 \ display
|
|
235 \ '::'
|
|
236
|
|
237 " allowable hotstring options:
|
|
238 " https://autohotkey.com/docs/Hotstrings.htm
|
|
239 syn match autohotkeyHotstringDefinition
|
|
240 \ contains=autohotkeyHotstring,
|
|
241 \ autohotkeyHotstringDelimiter
|
|
242 \ display
|
|
243 \ '^\s*:\%([*?]\|[BORZ]0\?\|C[01]\?\|K\d\+\|P\d\+\|S[IPE]\)*:.\{-}::'
|
|
244
|
|
245 syn match autohotkeyHotstring
|
|
246 \ contained
|
|
247 \ display
|
|
248 \ '.\{-}'
|
|
249
|
|
250 syn match autohotkeyHotstringDelimiter
|
|
251 \ contained
|
|
252 \ display
|
|
253 \ '::'
|
|
254
|
|
255 syn match autohotkeyHotstringDelimiter
|
|
256 \ contains=autohotkeyHotstringOptions
|
|
257 \ contained
|
|
258 \ display
|
|
259 \ ':\%([*?]\|[BORZ]0\?\|C[01]\?\|K\d\+\|P\d\+\|S[IPE]\)*:'
|
|
260
|
|
261 syn match autohotkeyHotstringOptions
|
|
262 \ contained
|
|
263 \ display
|
|
264 \ '\%([*?]\|[BORZ]0\?\|C[01]\?\|K\d\+\|P\d\+\|S[IPE]\)*'
|
|
265
|
|
266 syn cluster autohotkeyCommentGroup
|
|
267 \ contains=
|
|
268 \ autohotkeyTodo,
|
|
269 \ @Spell
|
|
270
|
|
271 syn match autohotkeyComment
|
|
272 \ display
|
|
273 \ contains=@autohotkeyCommentGroup
|
|
274 \ '\%(^;\|\s\+;\).*$'
|
|
275
|
|
276 syn region autohotkeyComment
|
|
277 \ contains=@autohotkeyCommentGroup
|
|
278 \ matchgroup=autohotkeyCommentStart
|
|
279 \ start='^\s*/\*'
|
|
280 \ end='^\s*\*/'
|
|
281
|
1698
|
282 " TODO: Shouldn't we look for g:, b:, variables before defaulting to
|
|
283 " something?
|
|
284 if exists("g:autohotkey_syntax_sync_minlines")
|
|
285 let b:autohotkey_syntax_sync_minlines = g:autohotkey_syntax_sync_minlines
|
|
286 else
|
|
287 let b:autohotkey_syntax_sync_minlines = 50
|
|
288 endif
|
|
289 exec "syn sync ccomment autohotkeyComment minlines=" . b:autohotkey_syntax_sync_minlines
|
|
290
|
1187
|
291 hi def link autohotkeyTodo Todo
|
|
292 hi def link autohotkeyComment Comment
|
|
293 hi def link autohotkeyCommentStart autohotkeyComment
|
|
294 hi def link autohotkeyEscape Special
|
|
295 hi def link autohotkeyHotkey Type
|
|
296 hi def link autohotkeyKey Type
|
|
297 hi def link autohotkeyDelimiter Delimiter
|
|
298 hi def link autohotkeyHotstringDefinition Type
|
|
299 hi def link autohotkeyHotstring Type
|
|
300 hi def link autohotkeyHotstringDelimiter autohotkeyDelimiter
|
|
301 hi def link autohotkeyHotstringOptions Special
|
|
302 hi def link autohotkeyString String
|
|
303 hi def link autohotkeyStringDelimiter autohotkeyString
|
|
304 hi def link autohotkeyVariable Identifier
|
|
305 hi def link autohotkeyVariableDelimiter autohotkeyVariable
|
|
306 hi def link autohotkeyBuiltinVariable Macro
|
|
307 hi def link autohotkeyCommand Keyword
|
|
308 hi def link autohotkeyFunction Function
|
|
309 hi def link autohotkeyStatement autohotkeyCommand
|
|
310 hi def link autohotkeyRepeat Repeat
|
|
311 hi def link autohotkeyConditional Conditional
|
|
312 hi def link autohotkeyPreProcStart PreProc
|
|
313 hi def link autohotkeyInclude Include
|
|
314 hi def link autohotkeyPreProc PreProc
|
|
315 hi def link autohotkeyMatchClass Typedef
|
|
316 hi def link autohotkeyNumber Number
|
|
317 hi def link autohotkeyInteger autohotkeyNumber
|
|
318 hi def link autohotkeyFloat autohotkeyNumber
|
|
319 hi def link autohotkeyType Type
|
1618
|
320 hi def link autohotkeyBoolean Boolean
|
1187
|
321
|
|
322 let b:current_syntax = "autohotkey"
|
|
323
|
|
324 let &cpo = s:cpo_save
|
|
325 unlet s:cpo_save
|