PageRenderTime 27ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/runtime/syntax/autohotkey.vim

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