if v:version < 600 syntax clear elseif exists('b:current_syntax') finish endif " add the ; for ahk comments to work well (wrap and continue) set comments=s1:/*,mb:*,ex:*/,:; sy case ignore sy keyword ahkKeyword ahk_id ahk_pid ahk_class ahk_group ahk_parent true false " this is a great hack by savage. The problem is that it colors whatever you are " writing in ahkFunction color, and then it turns normal when you leave. Very " distracting. The solution is less elegant: list all posible ahk commands, " which we do next. " sy match ahkFunction "^\s*\w\{1,}," " sy match ahkFunction "\w\{1,}," contained " sy match ahkFunction "^\s*\w\{1,}\s*$" contains=ahkStatement " sy match ahkFunction "\w\{1,}\s*$" contained syn keyword ahkFunction \ ClipWait EnvGet EnvSet EnvUpdate \ Drive DriveGet DriveSpaceFree FileAppend FileCopy FileCopyDir \ FileCreateDir FileCreateShortcut FileDelete FileGetAttrib \ FileGetShortcut FileGetSize FileGetTime FileGetVersion FileInstall \ FileMove FileMoveDir FileReadLine FileRead FileRecycle FileRecycleEmpty \ FileRemoveDir FileSelectFolder FileSelectFile FileSetAttrib FileSetTime \ IniDelete IniRead IniWrite SetWorkingDir \ SplitPath \ Gui GuiControl GuiControlGet IfMsgBox InputBox MsgBox Progress \ SplashImage SplashTextOn SplashTextOff ToolTip TrayTip \ Hotkey ListHotkeys BlockInput ControlSend ControlSendRaw GetKeyState \ KeyHistory KeyWait Input Send SendRaw SendInput SendPlay SendEvent \ SendMode SetKeyDelay SetNumScrollCapsLockState SetStoreCapslockMode \ EnvAdd EnvDiv EnvMult EnvSub Random SetFormat Transform \ AutoTrim BlockInput CoordMode Critical Edit ImageSearch \ ListLines ListVars Menu OutputDebug PixelGetColor PixelSearch \ SetBatchLines SetEnv SetTimer SysGet Thread Transform URLDownloadToFile \ Click ControlClick MouseClick MouseClickDrag MouseGetPos MouseMove \ SetDefaultMouseSpeed SetMouseDelay \ Process Run RunWait RunAs Shutdown Sleep \ RegDelete RegRead RegWrite \ SoundBeep SoundGet SoundGetWaveVolume SoundPlay SoundSet \ SoundSetWaveVolume \ FormatTime IfInString IfNotInString Sort StringCaseSense StringGetPos \ StringLeft StringRight StringLower StringUpper StringMid StringReplace \ StringSplit StringTrimLeft StringTrimRight \ Control ControlClick ControlFocus ControlGet ControlGetFocus \ ControlGetPos ControlGetText ControlMove ControlSend ControlSendRaw \ ControlSetText Menu PostMessage SendMessage SetControlDelay \ WinMenuSelectItem GroupActivate GroupAdd GroupClose GroupDeactivate \ DetectHiddenText DetectHiddenWindows SetTitleMatchMode SetWinDelay \ StatusBarGetText StatusBarWait WinActivate WinActivateBottom WinClose \ WinGet WinGetActiveStats WinGetActiveTitle WinGetClass WinGetPos \ WinGetText WinGetTitle WinHide WinKill WinMaximize WinMinimize \ WinMinimizeAll WinMinimizeAllUndo WinMove WinRestore WinSet \ WinSetTitle WinShow WinWait WinWaitActive WinWaitNotActive WinWaitClose \ InStr RegExMatch RegExReplace StrLen SubStr Asc Chr \ DllCall VarSetCapacity WinActive WinExist IsLabel OnMessage \ Abs Ceil Exp Floor Log Ln Mod Round Sqrt Sin Cos Tan ASin ACos ATan \ FileExist GetKeyState numput numget RegisterCallback " these are user-defined functions, in dark green sy match ahkNewFunction "\s*\w\{1,}(.*)" sy match ahkNewFunctionParams "(\@<=.*)\@=" containedin=ahkNewFunction sy match ahkEscape "`." containedin=ahkFunction,ahkLabel,ahkVariable,ahkNewFunctionParams " I don't like %var value% being in a different color than the var itself, so " commented out. "sy match ahkVariable "%.\{-}%" containedin=ahkNewFunctionParams "sy match ahkVariable "%.\{-}%" sy match ahkKey "[!#^+]\{1,4}`\=.\n" contains=ahkEscape sy match ahkKey "[!#^+]\{0,4}{.\{-}}" sy match ahkDirective "^#[a-zA-Z]\{2,\}" sy match ahkLabel "^\w\+:\s*$" sy match ahkLabel "^[^,]\+:\{2\}\(\w\+,\)\=" contains=ahkFunction sy match ahkLabel "^[^,]\+:\{2\}\w\+\s*$" contains=ahkFunction sy match ahkLabel "^:.\+:.*::" sy keyword ahkLabel return containedin=ahkFunction sy match ahkStatement "^\s*if\w*\(,\)\=" sy keyword ahkStatement If Else Loop Loop, exitapp containedin=ahkFunction sy match ahkComment "`\@