├── README └── syntax └── autohotkey.vim /README: -------------------------------------------------------------------------------- 1 | This is a mirror of http://www.vim.org/scripts/script.php?script_id=2112 2 | 3 | autohotkey (ahk) syntax file. 4 | Best in combination with color scheme pspad. 5 | 6 | Examples: 7 | Isense script 8 | http://academicproductivity.com/software/ISense.ahk.html 9 | 10 | activeGoto script 11 | http://academicproductivity.com/software/activegoto.ahk.html 12 | 13 | In a Nutshell: 14 | Built-in finctions are blue 15 | User defined functions are green 16 | Autohotkey variables are orange 17 | Labels are red (return too; makes it easy to find subs scopes) 18 | GUI commands, others, are brown 19 | 20 | -------------------------------------------------------------------------------- /syntax/autohotkey.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | 3 | " Language: Autohotkey from www.autohotkey.com 4 | " Maintainer: Jose Quesada (quesada AT gmail DOT com) 5 | " based on previous versions: 6 | " savage - kallen19918 AT earthlink DOT net 7 | " Nikolai Weibull 8 | 9 | " best used with pspad.vim colors scheme 10 | 11 | "Usage: 12 | "1) Copy this file into your $VIM/syntax directory. 13 | "2) Add this line to filetype.vim: 14 | "au BufNewFile,BufRead *.ahk setf ahk 15 | 16 | 17 | 18 | " For version 5.x: Clear all syntax items 19 | " For version 6.x: Quit when a syntax file was already loaded 20 | if version < 600 21 | syntax clear 22 | elseif exists("b:current_syntax") 23 | finish 24 | endif 25 | 26 | " add the ; for ahk comments to work well (wrap and continue) 27 | set comments=s1:/*,mb:*,ex:*/,:; 28 | 29 | sy case ignore 30 | 31 | 32 | sy keyword ahkKeyword ahk_id ahk_pid ahk_class ahk_group ahk_parent true false 33 | 34 | 35 | " this is a great hack by savage. The problem is that it colors whatever you are 36 | " writing in ahkFunction color, and then it turns normal when you leave. Very 37 | " distracting. The solution is less elegant: list all posible ahk commands, 38 | " which we do next. 39 | 40 | " sy match ahkFunction "^\s*\w\{1,}," 41 | " sy match ahkFunction "\w\{1,}," contained 42 | " sy match ahkFunction "^\s*\w\{1,}\s*$" contains=ahkStatement 43 | " sy match ahkFunction "\w\{1,}\s*$" contained 44 | syn keyword ahkFunction 45 | \ ClipWait EnvGet EnvSet EnvUpdate 46 | \ Drive DriveGet DriveSpaceFree FileAppend FileCopy FileCopyDir 47 | \ FileCreateDir FileCreateShortcut FileDelete FileGetAttrib 48 | \ FileGetShortcut FileGetSize FileGetTime FileGetVersion FileInstall 49 | \ FileMove FileMoveDir FileReadLine FileRead FileRecycle FileRecycleEmpty 50 | \ FileRemoveDir FileSelectFolder FileSelectFile FileSetAttrib FileSetTime 51 | \ IniDelete IniRead IniWrite SetWorkingDir 52 | \ SplitPath 53 | \ Gui GuiControl GuiControlGet IfMsgBox InputBox MsgBox Progress 54 | \ SplashImage SplashTextOn SplashTextOff ToolTip TrayTip 55 | \ Hotkey ListHotkeys BlockInput ControlSend ControlSendRaw GetKeyState 56 | \ KeyHistory KeyWait Input Send SendRaw SendInput SendPlay SendEvent 57 | \ SendMode SetKeyDelay SetNumScrollCapsLockState SetStoreCapslockMode 58 | \ EnvAdd EnvDiv EnvMult EnvSub Random SetFormat Transform 59 | \ AutoTrim BlockInput CoordMode Critical Edit ImageSearch 60 | \ ListLines ListVars Menu OutputDebug PixelGetColor PixelSearch 61 | \ SetBatchLines SetEnv SetTimer SysGet Thread Transform URLDownloadToFile 62 | \ Click ControlClick MouseClick MouseClickDrag MouseGetPos MouseMove 63 | \ SetDefaultMouseSpeed SetMouseDelay 64 | \ Process Run RunWait RunAs Shutdown Sleep 65 | \ RegDelete RegRead RegWrite 66 | \ SoundBeep SoundGet SoundGetWaveVolume SoundPlay SoundSet 67 | \ SoundSetWaveVolume 68 | \ FormatTime IfInString IfNotInString Sort StringCaseSense StringGetPos 69 | \ StringLeft StringRight StringLower StringUpper StringMid StringReplace 70 | \ StringSplit StringTrimLeft StringTrimRight 71 | \ Control ControlClick ControlFocus ControlGet ControlGetFocus 72 | \ ControlGetPos ControlGetText ControlMove ControlSend ControlSendRaw 73 | \ ControlSetText Menu PostMessage SendMessage SetControlDelay 74 | \ WinMenuSelectItem GroupActivate GroupAdd GroupClose GroupDeactivate 75 | \ DetectHiddenText DetectHiddenWindows SetTitleMatchMode SetWinDelay 76 | \ StatusBarGetText StatusBarWait WinActivate WinActivateBottom WinClose 77 | \ WinGet WinGetActiveStats WinGetActiveTitle WinGetClass WinGetPos 78 | \ WinGetText WinGetTitle WinHide WinKill WinMaximize WinMinimize 79 | \ WinMinimizeAll WinMinimizeAllUndo WinMove WinRestore WinSet 80 | \ WinSetTitle WinShow WinWait WinWaitActive WinWaitNotActive WinWaitClose 81 | \ InStr RegExMatch RegExReplace StrLen SubStr Asc Chr 82 | \ DllCall VarSetCapacity WinActive WinExist IsLabel OnMessage 83 | \ Abs Ceil Exp Floor Log Ln Mod Round Sqrt Sin Cos Tan ASin ACos ATan 84 | \ FileExist GetKeyState numput numget RegisterCallback 85 | 86 | " these are user-defined functions, in dark green 87 | sy match ahkNewFunction "\s*\w\{1,}(.*)" 88 | sy match ahkNewFunctionParams "(\@<=.*)\@=" containedin=ahkNewFunction 89 | 90 | sy match ahkEscape "`." containedin=ahkFunction,ahkLabel,ahkVariable,ahkNewFunctionParams 91 | 92 | " I don't like %var value% being in a different color than the var itself, so 93 | " commented out. 94 | "sy match ahkVariable "%.\{-}%" containedin=ahkNewFunctionParams 95 | "sy match ahkVariable "%.\{-}%" 96 | 97 | sy match ahkKey "[!#^+]\{1,4}`\=.\n" contains=ahkEscape 98 | sy match ahkKey "[!#^+]\{0,4}{.\{-}}" 99 | 100 | 101 | sy match ahkDirective "^#[a-zA-Z]\{2,\}" 102 | 103 | sy match ahkLabel "^\w\+:\s*$" 104 | sy match ahkLabel "^[^,]\+:\{2\}\(\w\+,\)\=" contains=ahkFunction 105 | sy match ahkLabel "^[^,]\+:\{2\}\w\+\s*$" contains=ahkFunction 106 | sy match ahkLabel "^:.\+:.*::" 107 | sy keyword ahkLabel return containedin=ahkFunction 108 | 109 | sy match ahkStatement "^\s*if\w*\(,\)\=" 110 | sy keyword ahkStatement If Else Loop Loop, exitapp containedin=ahkFunction 111 | 112 | sy match ahkComment "`\@