/RuntimeUpgrades/syntax/ahk.vim

https://bitbucket.org/WscriChy/vim-configuration · Vim Script · 71 lines · 40 code · 22 blank · 9 comment · 1 complexity · 7ab8fe0137f2c41ebacc5b6395b2f63d MD5 · raw file

  1. " Vim syntax file
  2. " Language: Autohotkey from www.autohotkey.com
  3. " Maintainer: savage - kallen19918 AT earthlink DOT net
  4. "Usage:
  5. "1) Copy this file into your $VIM/syntax directory.
  6. "2) Add this line to filetype.vim:
  7. "au BufNewFile,BufRead *.ahk setf ahk
  8. " For version 5.x: Clear all syntax items
  9. " For version 6.x: Quit when a syntax file was already loaded
  10. if version < 600
  11. syntax clear
  12. elseif exists("b:current_syntax")
  13. finish
  14. endif
  15. sy case ignore
  16. sy keyword ahkKeyword ahk_id ahk_pid ahk_class ahk_group ahk_parent true false
  17. sy match ahkFunction "^\s*\w\{1,},"
  18. sy match ahkFunction "\w\{1,}," contained
  19. sy match ahkFunction "^\s*\w\{1,}\s*$" contains=ahkStatement
  20. sy match ahkFunction "\w\{1,}\s*$" contained
  21. sy match ahkNewFunction "\s*\w\{1,}(.*)"
  22. sy match ahkNewFunctionParams "(\@<=.*)\@=" containedin=ahkNewFunction
  23. sy match ahkEscape "`." containedin=ahkFunction,ahkLabel,ahkVariable,ahkNewFunctionParams
  24. sy match ahkVariable "%.*%" containedin=ahkNewFunctionParams
  25. sy match ahkVariable "%.*%"
  26. sy match ahkKey "[!#^+]\{1,4}`\=.\n" contains=ahkEscape
  27. sy match ahkKey "[!#^+]\{0,4}{.\{-}}"
  28. sy match ahkDirective "^#[a-zA-Z]\{2,\}"
  29. sy match ahkLabel "^\w\+:\s*$"
  30. sy match ahkLabel "^[^,]\+:\{2\}\(\w\+,\)\=" contains=ahkFunction
  31. sy match ahkLabel "^[^,]\+:\{2\}\w\+\s*$" contains=ahkFunction
  32. sy match ahkLabel "^:.\+:.*::"
  33. sy keyword ahkLabel return containedin=ahkFunction
  34. sy match ahkStatement "^\s*if\w*\(,\)\="
  35. sy keyword ahkStatement If Else Loop Loop, exitapp containedin=ahkFunction
  36. sy match ahkComment "`\@<!;.*" contains=NONE
  37. sy match ahkComment "\/\*\_.\{-}\*\/" contains=NONE
  38. hi def link ahkKeyword Special
  39. hi def link ahkEscape Special
  40. hi def link ahkComment Comment
  41. hi def link ahkStatement Conditional
  42. hi def link ahkFunction Type
  43. hi def link ahkDirective Include
  44. hi def link ahkLabel Label
  45. hi def link ahkKey Special
  46. hi def link ahkVariable Constant
  47. hi def link ahkNewFunction Type
  48. sy sync fromstart
  49. let b:current_syntax = "ahk"