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