You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.8KB

  1. %YAML 1.2
  2. ---
  3. # http://www.sublimetext.com/docs/3/syntax.html
  4. name: VimL
  5. file_extensions:
  6. - vim
  7. scope: source.viml
  8. contexts:
  9. main:
  10. - include: comment
  11. - include: string_quoted_double
  12. - include: string_quoted_single
  13. - include: string_regex
  14. - include: inline_comment
  15. - include: number_int
  16. - include: number_hex
  17. - include: keyword
  18. - include: support_function
  19. - include: support_variable
  20. - include: support_type
  21. - include: function_params
  22. - include: function_definition
  23. - include: function_call
  24. - include: function
  25. - include: variable
  26. - include: expr
  27. comment:
  28. - match: ^\s*".*$
  29. scope: comment.line.quotes.viml
  30. captures:
  31. 1: punctuation.definition.comment.vim
  32. expr:
  33. - match: (\|\||&&|==(\?|#)?|(!|>|<)=(#|\?)?|(=|!)~(#|\?)?|(>|<)(#|\?)is|isnot|\.|\*|\\|%)
  34. scope: storage.function.viml
  35. function:
  36. - match: \b(fu(n|nction)?|end(f|fu|fun|function)?)\b
  37. scope: storage.function.viml
  38. function_call:
  39. - match: '(([sgbwtl]|)?:?[0-9a-zA-Z_#]+)(?=\()'
  40. scope: support.function.any-method
  41. function_definition:
  42. - match: '^\s*(function)\s*!?\s+(?=(s:)?[0-9a-zA-Z_#]+\s*\()'
  43. captures:
  44. 1: storage.function.viml
  45. push:
  46. - meta_scope: meta.function.viml
  47. - match: (\()
  48. captures:
  49. 1: punctuation.definition.parameters.begin.viml
  50. pop: true
  51. - match: "(s:)?[0-9a-zA-Z_#]+"
  52. scope: entity.name.function.viml
  53. function_params:
  54. - match: '-\w+='
  55. scope: support.type.viml
  56. inline_comment:
  57. - match: '(?!\$)(")(?!\{).*$\n?'
  58. scope: comment.line.quotes.viml
  59. captures:
  60. 1: punctuation.definition.comment.vim
  61. keyword:
  62. - match: \b(if|while|for|try|return|throw|end(if|for|while|try)?|au(g|group)|else(if|)?|do|in|catch|finally|:)\b
  63. scope: keyword.control.viml
  64. number_hex:
  65. - match: "#[0-9a-f]{6}"
  66. scope: constant.numeric.hex
  67. number_int:
  68. - match: '-?\d+'
  69. scope: constant.numeric.integer
  70. string_quoted_double:
  71. - match: '"(\\\\|\\"|\n[^\S\n]*\\|[^\n"])*"'
  72. scope: string.quoted.double.viml
  73. string_quoted_single:
  74. - match: '''(''''|\n[^\S\n]*\\|[^\n''])*'''
  75. scope: string.quoted.single.viml
  76. string_regex:
  77. - match: '/(\\\\|\\/|\n[^\S\n]*\\|[^\n/])*/'
  78. scope: string.regexp.viml
  79. support_function:
  80. - match: \b(set(local|global)?|let|command|filetype|colorscheme|\w*map|\w*a(b|brev)?|syn|exe(c|cute)?|ec(ho|)?|au(tocmd|)?)\b
  81. scope: support.function.viml
  82. support_type:
  83. - match: <.*?>
  84. scope: support.type.viml
  85. support_variable:
  86. - match: '\b(am(enu|)?|(hl|inc)?search|[Bb]uf([Nn]ew[Ff]ile|[Rr]ead)?|[Ff]ile[Tt]ype)\b'
  87. scope: support.variable.viml
  88. variable:
  89. - match: '([sSgGbBwWlLaAvV]:|@|$|&(?!&))\w*'
  90. scope: variable.other.viml