1
0
Fork 0
mirror of https://github.com/vim/vim synced 2025-03-20 08:45:11 +01:00
vim/runtime/syntax/autohotkey.vim

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

326 lines
12 KiB
VimL
Raw Permalink Normal View History

2007-05-10 16:44:05 +00:00
" Vim syntax file
" Language: AutoHotkey script file
2017-01-28 18:34:47 +01:00
" Maintainer: Michael Wong
" https://github.com/mmikeww/autohotkey.vim
2022-07-29 21:36:21 +01:00
" Latest Revision: 2022-07-25
2017-01-28 18:34:47 +01:00
" Previous Maintainers: SungHyun Nam <goweol@gmail.com>
" Nikolai Weibull <now@bitwi.se>
2007-05-10 16:44:05 +00:00
if exists("b:current_syntax")
finish
endif
let s:cpo_save = &cpo
set cpo&vim
syn case ignore
syn keyword autohotkeyTodo
\ contained
\ TODO FIXME XXX NOTE
2017-01-28 18:34:47 +01:00
" only these chars are valid as escape sequences: ,%`;nrbtvaf
" https://autohotkey.com/docs/commands/_EscapeChar.htm
2007-05-10 16:44:05 +00:00
syn match autohotkeyEscape
\ display
2017-01-28 18:34:47 +01:00
\ '`[,%`;nrbtvaf]'
2007-05-10 16:44:05 +00:00
syn region autohotkeyString
\ display
\ oneline
\ matchgroup=autohotkeyStringDelimiter
\ start=+"+
\ end=+"+
2022-07-29 21:36:21 +01:00
\ contains=autohotkeyEscape,autohotkeyMatchClass
2007-05-10 16:44:05 +00:00
2017-01-28 18:34:47 +01:00
syn match autohotkeyVariable
2007-05-10 16:44:05 +00:00
\ display
\ oneline
\ contains=autohotkeyBuiltinVariable
\ keepend
2017-01-28 18:34:47 +01:00
\ '%\S\{-}%'
2007-05-10 16:44:05 +00:00
syn keyword autohotkeyBuiltinVariable
\ A_Space A_Tab
2017-01-28 18:34:47 +01:00
\ A_WorkingDir A_ScriptDir A_ScriptName A_ScriptFullPath A_ScriptHwnd A_LineNumber
\ A_LineFile A_ThisFunc A_ThisLabel A_AhkVersion A_AhkPath A_IsUnicode A_IsCompiled A_ExitReason
\ A_YYYY A_MM A_DD A_MMMM A_MMM A_DDDD A_DDD A_WDay A_YDay A_YWeek A_Hour A_Min
\ A_Mon A_Year A_MDay A_NumBatchLines
2007-05-10 16:44:05 +00:00
\ A_Sec A_MSec A_Now A_NowUTC A_TickCount
2017-01-28 18:34:47 +01:00
\ A_IsSuspended A_IsPaused A_IsCritical A_BatchLines A_TitleMatchMode A_TitleMatchModeSpeed
\ A_DetectHiddenWindows A_DetectHiddenText A_AutoTrim A_StringCaseSense
2022-07-29 21:36:21 +01:00
\ A_FileEncoding A_FormatInteger A_FormatFloat A_WinDelay A_ControlDelay
\ A_SendMode A_SendLevel A_StoreCapsLockMode A_KeyDelay A_KeyDuration
\ A_KeyDelayPlay A_KeyDurationPlay A_MouseDelayPlay
2017-01-28 18:34:47 +01:00
\ A_MouseDelay A_DefaultMouseSpeed A_RegView A_IconHidden A_IconTip A_IconFile
\ A_CoordModeToolTip A_CoordModePixel A_CoordModeMouse A_CoordModeCaret A_CoordModeMenu
2007-05-10 16:44:05 +00:00
\ A_IconNumber
2017-01-28 18:34:47 +01:00
\ A_TimeIdle A_TimeIdlePhysical A_DefaultGui A_DefaultListView A_DefaultTreeView
2007-05-10 16:44:05 +00:00
\ A_Gui A_GuiControl A_GuiWidth A_GuiHeight A_GuiX A_GuiY A_GuiEvent
\ A_GuiControlEvent A_EventInfo
\ A_ThisMenuItem A_ThisMenu A_ThisMenuItemPos A_ThisHotkey A_PriorHotkey
2017-01-28 18:34:47 +01:00
\ A_PriorKey A_TimeSinceThisHotkey A_TimeSincePriorHotkey A_EndChar
2007-05-10 16:44:05 +00:00
\ ComSpec A_Temp A_OSType A_OSVersion A_Language A_ComputerName A_UserName
2017-01-28 18:34:47 +01:00
\ A_Is64BitOS A_PtrSize
2007-05-10 16:44:05 +00:00
\ A_WinDir A_ProgramFiles ProgramFiles A_AppData A_AppDataCommon A_Desktop
\ A_DesktopCommon A_StartMenu A_StartMenuCommon A_Programs
\ A_ProgramsCommon A_Startup A_StartupCommon A_MyDocuments A_IsAdmin
2017-01-28 18:34:47 +01:00
\ A_ScreenWidth A_ScreenHeight A_ScreenDPI A_IPAddress1 A_IPAddress2 A_IPAddress3
2007-05-10 16:44:05 +00:00
\ A_IPAddress4
\ A_Cursor A_CaretX A_CaretY Clipboard ClipboardAll ErrorLevel A_LastError
\ A_Index A_LoopFileName A_LoopRegName A_LoopReadLine A_LoopField
2017-01-28 18:34:47 +01:00
\ A_LoopFileExt A_LoopFileFullPath A_LoopFileLongPath A_LoopFileShortPath
\ A_LoopFileShortName A_LoopFileDir A_LoopFileTimeModified A_LoopFileTimeCreated
\ A_LoopFileTimeAccessed A_LoopFileAttrib A_LoopFileSize A_LoopFileSizeKB A_LoopFileSizeMB
\ A_LoopRegType A_LoopRegKey A_LoopRegSubKey A_LoopRegTimeModified
2022-07-29 21:36:21 +01:00
\ A_TimeIdleKeyboard A_TimeIdleMouse A_ListLines A_ComSpec A_LoopFilePath A_Args
2007-05-10 16:44:05 +00:00
syn match autohotkeyBuiltinVariable
\ contained
\ display
\ '%\d\+%'
syn keyword autohotkeyCommand
\ ClipWait EnvGet EnvSet EnvUpdate
\ Drive DriveGet DriveSpaceFree FileAppend FileCopy FileCopyDir
2017-01-28 18:34:47 +01:00
\ FileCreateDir FileCreateShortcut FileDelete FileGetAttrib FileEncoding
2007-05-10 16:44:05 +00:00
\ 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
2017-01-28 18:34:47 +01:00
\ StringSplit StringTrimLeft StringTrimRight StringLen
2017-04-09 20:11:58 +02:00
\ StrSplit StrReplace Throw
2007-05-10 16:44:05 +00:00
\ 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
2017-01-28 18:34:47 +01:00
\ SetCapsLockState SetNumLockState SetScrollLockState
2022-07-29 21:36:21 +01:00
\ Hotstring LoadPicture MenuGetHandle MenuGetName OnError OnClipboardChange
2007-05-10 16:44:05 +00:00
syn keyword autohotkeyFunction
2017-04-09 20:11:58 +02:00
\ InStr RegExMatch RegExReplace StrLen SubStr Asc Chr Func
2007-05-10 16:44:05 +00:00
\ DllCall VarSetCapacity WinActive WinExist IsLabel OnMessage
\ Abs Ceil Exp Floor Log Ln Mod Round Sqrt Sin Cos Tan ASin ACos ATan
2017-01-28 18:34:47 +01:00
\ FileExist GetKeyState NumGet NumPut StrGet StrPut RegisterCallback
\ IsFunc Trim LTrim RTrim IsObject Object Array FileOpen
\ ComObjActive ComObjArray ComObjConnect ComObjCreate ComObjGet
\ ComObjError ComObjFlags ComObjQuery ComObjType ComObjValue ComObject
2022-07-29 21:36:21 +01:00
\ Format Exception Ord InputHook
2007-05-10 16:44:05 +00:00
syn keyword autohotkeyStatement
\ Break Continue Exit ExitApp Gosub Goto OnExit Pause Return
2017-04-09 20:11:58 +02:00
\ Suspend Reload new class extends
2007-05-10 16:44:05 +00:00
syn keyword autohotkeyRepeat
\ Loop
syn keyword autohotkeyConditional
\ IfExist IfNotExist If IfEqual IfLess IfGreater Else
2017-01-28 18:34:47 +01:00
\ IfWinExist IfWinNotExist IfWinActive IfWinNotActive
\ IfNotEqual IfLessOrEqual IfGreaterOrEqual
2022-07-29 21:36:21 +01:00
\ while until for in try catch finally not
\ switch case default
2007-05-10 16:44:05 +00:00
syn match autohotkeyPreProcStart
\ nextgroup=
\ autohotkeyInclude,
\ autohotkeyPreProc
\ skipwhite
\ display
\ '^\s*\zs#'
syn keyword autohotkeyInclude
\ contained
\ Include
\ IncludeAgain
syn keyword autohotkeyPreProc
\ contained
\ HotkeyInterval HotKeyModifierTimeout
\ Hotstring
\ IfWinActive IfWinNotActive IfWinExist IfWinNotExist
2017-01-28 18:34:47 +01:00
\ If IfTimeout
2007-05-10 16:44:05 +00:00
\ MaxHotkeysPerInterval MaxThreads MaxThreadsBuffer MaxThreadsPerHotkey
\ UseHook InstallKeybdHook InstallMouseHook
\ KeyHistory
\ NoTrayIcon SingleInstance
\ WinActivateForce
\ AllowSameLineComments
\ ClipboardTimeout
\ CommentFlag
\ ErrorStdOut
\ EscapeChar
\ MaxMem
\ NoEnv
\ Persistent
2017-01-28 18:34:47 +01:00
\ LTrim
\ InputLevel
\ MenuMaskKey
\ Warn
2007-05-10 16:44:05 +00:00
syn keyword autohotkeyMatchClass
2017-04-09 20:11:58 +02:00
\ ahk_group ahk_class ahk_id ahk_pid ahk_exe
2007-05-10 16:44:05 +00:00
syn match autohotkeyNumbers
\ display
\ transparent
\ contains=
\ autohotkeyInteger,
\ autohotkeyFloat
\ '\<\d\|\.\d'
syn match autohotkeyInteger
\ contained
\ display
\ '\d\+\>'
syn match autohotkeyInteger
\ contained
\ display
\ '0x\x\+\>'
syn match autohotkeyFloat
\ contained
\ display
\ '\d\+\.\d*\|\.\d\+\>'
syn keyword autohotkeyType
\ local
\ global
2017-01-28 18:34:47 +01:00
\ static
\ byref
2007-05-10 16:44:05 +00:00
2008-06-24 20:19:36 +00:00
syn keyword autohotkeyBoolean
\ true
\ false
2017-01-28 18:34:47 +01:00
syn match autohotkeyHotkey
\ contains=autohotkeyKey,
\ autohotkeyHotkeyDelimiter
\ display
2017-04-09 20:11:58 +02:00
\ '^\s*\S*\%( Up\)\?::'
2017-01-28 18:34:47 +01:00
syn match autohotkeyKey
\ contained
\ display
\ '^.\{-}'
syn match autohotkeyDelimiter
\ contained
\ display
\ '::'
" allowable hotstring options:
" https://autohotkey.com/docs/Hotstrings.htm
syn match autohotkeyHotstringDefinition
\ contains=autohotkeyHotstring,
\ autohotkeyHotstringDelimiter
\ display
\ '^\s*:\%([*?]\|[BORZ]0\?\|C[01]\?\|K\d\+\|P\d\+\|S[IPE]\)*:.\{-}::'
syn match autohotkeyHotstring
\ contained
\ display
\ '.\{-}'
syn match autohotkeyHotstringDelimiter
\ contained
\ display
\ '::'
syn match autohotkeyHotstringDelimiter
\ contains=autohotkeyHotstringOptions
\ contained
\ display
\ ':\%([*?]\|[BORZ]0\?\|C[01]\?\|K\d\+\|P\d\+\|S[IPE]\)*:'
syn match autohotkeyHotstringOptions
\ contained
\ display
\ '\%([*?]\|[BORZ]0\?\|C[01]\?\|K\d\+\|P\d\+\|S[IPE]\)*'
syn cluster autohotkeyCommentGroup
\ contains=
\ autohotkeyTodo,
\ @Spell
syn match autohotkeyComment
\ display
\ contains=@autohotkeyCommentGroup
\ '\%(^;\|\s\+;\).*$'
syn region autohotkeyComment
\ contains=@autohotkeyCommentGroup
\ matchgroup=autohotkeyCommentStart
\ start='^\s*/\*'
\ end='^\s*\*/'
2008-08-06 17:06:04 +00:00
" TODO: Shouldn't we look for g:, b:, variables before defaulting to
" something?
if exists("g:autohotkey_syntax_sync_minlines")
let b:autohotkey_syntax_sync_minlines = g:autohotkey_syntax_sync_minlines
else
let b:autohotkey_syntax_sync_minlines = 50
endif
exec "syn sync ccomment autohotkeyComment minlines=" . b:autohotkey_syntax_sync_minlines
2007-05-10 16:44:05 +00:00
hi def link autohotkeyTodo Todo
hi def link autohotkeyComment Comment
hi def link autohotkeyCommentStart autohotkeyComment
hi def link autohotkeyEscape Special
hi def link autohotkeyHotkey Type
hi def link autohotkeyKey Type
hi def link autohotkeyDelimiter Delimiter
hi def link autohotkeyHotstringDefinition Type
hi def link autohotkeyHotstring Type
hi def link autohotkeyHotstringDelimiter autohotkeyDelimiter
hi def link autohotkeyHotstringOptions Special
hi def link autohotkeyString String
hi def link autohotkeyStringDelimiter autohotkeyString
hi def link autohotkeyVariable Identifier
hi def link autohotkeyVariableDelimiter autohotkeyVariable
hi def link autohotkeyBuiltinVariable Macro
hi def link autohotkeyCommand Keyword
hi def link autohotkeyFunction Function
hi def link autohotkeyStatement autohotkeyCommand
hi def link autohotkeyRepeat Repeat
hi def link autohotkeyConditional Conditional
hi def link autohotkeyPreProcStart PreProc
hi def link autohotkeyInclude Include
hi def link autohotkeyPreProc PreProc
hi def link autohotkeyMatchClass Typedef
hi def link autohotkeyNumber Number
hi def link autohotkeyInteger autohotkeyNumber
hi def link autohotkeyFloat autohotkeyNumber
hi def link autohotkeyType Type
2008-06-24 20:19:36 +00:00
hi def link autohotkeyBoolean Boolean
2007-05-10 16:44:05 +00:00
let b:current_syntax = "autohotkey"
let &cpo = s:cpo_save
unlet s:cpo_save