Skip to content

Commit

Permalink
Add basic TypeScript and improve TSX support (#208)
Browse files Browse the repository at this point in the history
Basic highlighting support for TypeScript & TSX

Added basic support to highlight TypeScript & TSX syntax more
consistently through the HerringtonDarkholme/yats.vim plugin [1].
This includes improvements to highlight...

1. ...TypeScript interface an class names using `nord7` as foreground,
   where interfaces also use the bold attribute, to match with
   structs/classes.
2. ...global methods like e.g. `setTimeout` with `nord8` using the
   italic attribute to mark it kind of static. 
3. ...regular expressions with `nord13` as foreground color instead of
   the normal color for quoted strings (`nord14`) to make it easier to
   differ between both. 
4. ...global objects like `Error`, `JSON` and `console` with `nord7`.
5. ...primitive/builtin types like `string` with `nord9`.
6. ...TypeScript type references with `nord7`.
7. ...TypeScript specific characters like for type annotations (`:`) and
   member optionality (`?`) as operator with `nord9`.

This also includes improvements for "vanilla" JavaScript elements.

[1]: https://github.com/HerringtonDarkholme/yats.vim

Resolves GH-208

Co-authored-by: Arctic Ice Studio <[email protected]>
Co-authored-by: Sven Greb <[email protected]>
  • Loading branch information
3 people committed Jun 20, 2020
1 parent e26b5d8 commit 1bd44ad
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions colors/nord.vim
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,47 @@ hi! link jsNoise Delimiter
hi! link jsPrototype Keyword
hi! link jsRegexpString SpecialChar

" TypeScript
" > HerringtonDarkholme/yats.vim
call s:hi("typescriptBOMWindowMethod", s:nord8_gui, "", s:nord8_term, "", s:italic, "")
call s:hi("typescriptClassName", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("typescriptDecorator", s:nord12_gui, "", s:nord12_term, "", "", "")
call s:hi("typescriptInterfaceName", s:nord7_gui, "", s:nord7_term, "", s:bold, "")
call s:hi("typescriptRegexpString", s:nord13_gui, "", s:nord13_term, "", "", "")
" TypeScript JSX
call s:hi("tsxAttrib", s:nord7_gui, "", s:nord7_term, "", "", "")
hi! link typescriptOperator Operator
hi! link typescriptBinaryOp Operator
hi! link typescriptAssign Operator
hi! link typescriptMember Identifier
hi! link typescriptDOMStorageMethod Identifier
hi! link typescriptArrowFuncArg Identifier
hi! link typescriptGlobal typescriptClassName
hi! link typescriptBOMWindowProp Function
hi! link typescriptArrowFuncDef Function
hi! link typescriptAliasDeclaration Function
hi! link typescriptPredefinedType Type
hi! link typescriptTypeReference typescriptClassName
hi! link typescriptTypeAnnotation Structure
hi! link typescriptDocNamedParamType SpecialComment
hi! link typescriptDocNotation Keyword
hi! link typescriptDocTags Keyword
hi! link typescriptImport Keyword
hi! link typescriptExport Keyword
hi! link typescriptTry Keyword
hi! link typescriptVariable Keyword
hi! link typescriptBraces Normal
hi! link typescriptObjectLabel Normal
hi! link typescriptCall Normal
hi! link typescriptClassHeritage typescriptClassName
hi! link typescriptFuncTypeArrow Structure
hi! link typescriptMemberOptionality Structure
hi! link typescriptNodeGlobal typescriptGlobal
hi! link typescriptTypeBrackets Structure
hi! link tsxEqual Operator
hi! link tsxIntrinsicTagName htmlTag
hi! link tsxTagName tsxIntrinsicTagName

" Markdown
" > plasticboy/vim-markdown
call s:hi("mkdCode", s:nord7_gui, "", s:nord7_term, "", "", "")
Expand Down

0 comments on commit 1bd44ad

Please sign in to comment.