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