javascript.vim 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. " Remove interface from future keys
  2. syn clear jsFutureKeys
  3. syn keyword jsFutureKeys final implements goto long synchronized volatile transient float boolean protected abstract native double short char enum throws byte int package
  4. syn keyword tsAccessibility public private
  5. syn keyword tsPrimitives string any number object
  6. syn keyword tsInterface interface nextgroup=tsInterfaceType,jsExtend skipwhite
  7. syn keyword jsExtend extends nextgroup=tsInterfaceType skipwhite
  8. syn match tsInterfaceType /\w\+/ nextgroup=jsBlock skipwhite contained
  9. syn keyword jsExport export nextgroup=@jsAll,jsModuleGroup,jsExportDefault,jsModuleAsterisk,jsModuleKeyword,jsFlowTypeStatement,tsInterface skipwhite skipempty
  10. syn region jsClassBlock matchgroup=jsClassBraces start=/{/ end=/}/ contained extend fold contains=jsClassFuncName,jsClassMethodType,jsArrowFunction,jsArrowFuncArgs,jsComment,jsGenerator,jsDecorator,jsClassProperty,jsClassPropertyComputed,jsClassStringKey,jsAsyncKeyword,jsNoise,tsAccessibility
  11. syn region jsFuncArgs matchgroup=jsFuncParens start=/(/ end=/)/ contains=jsFuncArgCommas,jsComment,jsFuncArgExpression,jsDestructuringBlock,jsDestructuringArray,jsRestExpression,jsFlowArgumentDef,tsVariableType nextgroup=jsCommentFunction,jsFuncBlock,jsFlowReturn,tsFuncReturnType skipwhite skipempty contained extend fold
  12. "syn region jsCommentFunction start=+//+ end=/$/ contained keepend extend contains=jsCommentTodo,@Spell nextgroup=jsFuncBlock,jsFlowReturn skipwhite skipempty start=+/\*+ end=+\*/+ contained keepend extend fold contains=jsCommentTodo,@Spell nextgroup=jsFuncBlock,jsFlowReturn skipwhite skipempty
  13. "syn match jsClassFuncName /\<\K\k*\ze\s*[(<]/ nextgroup=jsFuncArgs,jsFlowClassFunctionGroup skipwhite contained skipempty
  14. syn match jsVariableDef /\<\K\k*/ nextgroup=jsFlowDefinition,tsVariableType skipwhite skipempty contained
  15. syn match jsBlockLabel /\<\K\k*?\?\s*::\@!/ contains=jsNoise nextgroup=jsBlock skipwhite skipempty
  16. syn match tsVariableType /:\s\+\w\+\(.\w\+\)*/ nextgroup=jsFlowDefinition contains=tsTypeDecl,tsType skipwhite contained
  17. syn match tsFuncReturnType /:\s\+\w\+\(.\w\+\)*/ nextgroup=jsCommentFunction,jsFuncBlock,jsFlowReturn,jsFuncBraces contains=tsTypeDecl,tsType skipwhite contained
  18. syn match tsTypeDecl /:/ contained nextgroup=tsType
  19. syn match tsType /\w\+(\.\w\+)*/ contained
  20. " Override the default definitions, adding/removing as necessary
  21. syn cluster jsAll contains=@jsExpression,jsStorageClass,jsConditional,jsRepeat,jsReturn,jsException,jsTry,jsNoise,jsBlockLabel,tsPrimitives
  22. hi link jsObjectKey Special
  23. hi link jsClassDefinition Type
  24. hi link jsFutureKeys Keyword
  25. hi link tsInterface Keyword
  26. hi link tsAccessibility Keyword
  27. hi link jsExtend Keyword
  28. hi link tsInterfaceType Type
  29. hi link tsPrimitives Special
  30. hi link tsType Type
  31. hi link tsFuncReturnType tsType
  32. hi link tsVariableType tsType