annotate vendor/vim-syntax/tsx.vim @ 630:32fefb633034

Add support for tsx Not sure how it worked before.
author nanaya <me@nanaya.pro>
date Fri, 18 Oct 2019 15:43:00 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
630
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
1
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
2 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
3 " Vim syntax file
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
4 "
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
5 " Language: TSX (TypeScript)
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
6 "
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
7 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
8
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
9 " These are the plugin-to-syntax-element correspondences:
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
10 " - leafgarland/typescript-vim: typescriptFuncBlock
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
11
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
12
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
13 let s:tsx_cpo = &cpo
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
14 set cpo&vim
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
15
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
16 syntax case match
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
17
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
18 if exists('b:current_syntax')
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
19 let s:current_syntax = b:current_syntax
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
20 unlet b:current_syntax
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
21 endif
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
22
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
23 syn include @HTMLSyntax syntax/html.vim
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
24 if exists('s:current_syntax')
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
25 let b:current_syntax = s:current_syntax
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
26 endif
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
27
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
28 """""" Vim Syntax Help """"""
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
29 " `keepend` and `extend` docs:
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
30 " https://github.com/othree/til/blob/master/vim/syntax-keepend-extend.md
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
31
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
32 " \@<= positive lookbehind
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
33 " \@<! negative lookbehind
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
34 " \@= positive lookahead
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
35 " \@! negative lookahead
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
36
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
37
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
38
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
39 syntax case match
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
40
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
41 " <tag></tag>
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
42 " s~~~~~~~~~~~e
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
43 syntax region tsxRegion
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
44 \ start=+\(\([a-zA-Z]\)\@<!<>\|\(\s\|[(]\s*\)\@<=\z(<[/a-zA-Z],\@!\([a-zA-Z0-9:\-],\@!\)*\)\)+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
45 \ skip=+<!--\_.\{-}-->+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
46 \ end=+</\_.\{-}>+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
47 \ end=+[a-zA-Z0-9.]*[/]*>\s*\n*\s*\n*\s*[});,]\@=+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
48 \ contains=tsxTag,tsxCloseTag,tsxComment,Comment,@Spell,tsxColon,tsxIfOperator,tsxElseOperator,jsBlock
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
49 \ extend
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
50 \ keepend
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
51
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
52
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
53
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
54 " Negative lookbacks for:
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
55 " <> preceeded by [a-zA-Z]
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
56 " <<Tag...
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
57 " [a-zA-Z]<Tag
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
58
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
59 " end 1): handle </NormalClosingTag>
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
60 " end 2): handle <SelfClosingTags/>\s*\n*\s*\n*\s*)
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
61 " \s => spaces/tabs
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
62 " \n => end-of-line => \n only match end of line in the buffer.
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
63 " \s*\n*\s*\n*\s* => handles arbitrary spacing between closing tsxTag </tag>
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
64 " and the ending brace for the scope: `}` or `)`
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
65 "
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
66 " \z( pattern \) Braces can be used to make a pattern into an atom.
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
67
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
68 " <tag>{content}</tag>
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
69 " s~~~~~~~e
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
70 syn region jsBlock
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
71 \ start=+{+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
72 \ end=+}+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
73 \ contained
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
74 \ contains=TOP
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
75
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
76 " \@<= positive lookbehind
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
77 " \@<! negative lookbehind
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
78 " \@= positive lookahead
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
79 " \@! negative lookahead
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
80 " RULE: capture expression, then apply rule AFTER
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
81 " e.g foo\(bar\)\@!
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
82 " match all `foo` which is not followed by `bar`
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
83 " https://jbodah.github.io/blog/2016/11/01/positivenegative-lookaheadlookbehind-vim/
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
84
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
85 " <tag key={this.props.key}>
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
86 " s~~~~~~~~~~~~~~e
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
87 syntax region tsxJsBlock
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
88 \ matchgroup=tsxAttributeBraces start=+\([=]\|\s\)\@<={+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
89 \ matchgroup=tsxAttributeBraces end=+}\(\s*}\|)\)\@!+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
90 \ contained
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
91 \ keepend
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
92 \ extend
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
93 \ contains=TOP
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
94
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
95 " <tag id="sample">
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
96 " s~~~~~~~~~~~~~~~e
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
97 syntax region tsxTag
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
98 \ start=+<[^ /!?<"'=:]\@=+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
99 \ end=+[/]\{0,1}>+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
100 \ contained
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
101 \ contains=tsxTagName,tsxAttrib,tsxEqual,tsxString,tsxJsBlock,tsxAttributeComment,jsBlock,tsxGenerics
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
102
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
103 syntax region tsxGenerics
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
104 \ matchgroup=tsxTypeBraces start=+\([<][_\-\.:a-zA-Z0-9]*\|[<][_\-\.:a-zA-Z0-9]*\)\@<=\s*[<]+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
105 \ matchgroup=tsxTypeBraces end=+>+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
106 \ contains=tsxTypes,tsxGenerics
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
107 \ contained
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
108 \ extend
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
109
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
110 syntax match tsxTypes /[_\.a-zA-Z0-9]/
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
111 \ contained
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
112
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
113 " \@<! negative lookbehind
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
114
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
115 " <T1, T2>
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
116 " s~~~~~~~e
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
117 " For Generics outside of tsxRegion
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
118 " Must come after tsxRegion in this file
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
119 syntax region tsGenerics
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
120 \ start=+<\([\[A-Z]\|typeof\)\([a-zA-Z0-9,{}\[\]'".=>():]\|\s\)*>\(\s*\n*\s*[()]\|\s*[=]\)+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
121 \ end=+\([=]\)\@<!>+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
122 \ contains=tsxTypes,tsxGenerics
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
123 \ extend
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
124
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
125 " </tag>
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
126 " ~~~~~~
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
127 syntax region tsxCloseTag
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
128 \ start=+</[^ /!?<"'=:]\@=+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
129 \ end=+>+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
130 \ contained
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
131 \ contains=tsxCloseString
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
132
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
133 " matches tsx Comments: {/* ..... /*}
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
134 syn region Comment contained start=+{/\*+ end=+\*/}+ contains=Comment
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
135 \ extend
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
136
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
137 syn region tsxAttributeComment contained start=+//+ end=+\n+ contains=Comment
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
138 \ extend
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
139
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
140 syntax match tsxCloseString
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
141 \ +\w\++
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
142 \ contained
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
143
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
144 syntax match tsxColon
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
145 \ +[;]+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
146 \ contained
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
147
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
148 " <!-- -->
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
149 " ~~~~~~~~
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
150 syntax match tsxComment /<!--\_.\{-}-->/ display
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
151 syntax match tsxEntity "&[^; \t]*;" contains=tsxEntityPunct
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
152 syntax match tsxEntityPunct contained "[&.;]"
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
153
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
154 " <tag key={this.props.key}>
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
155 " ~~~
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
156 syntax match tsxTagName
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
157 \ +[<]\@<=[^ /!?<>"']\++
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
158 \ contained
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
159 \ display
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
160
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
161 " <tag key={this.props.key}>
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
162 " ~~~
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
163 syntax match tsxAttrib
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
164 \ +[-'"<]\@<!\<[a-zA-Z:_][-.0-9a-zA-Z0-9:_]*[/]\{0,1}\>\(['"]\@!\|$\)+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
165 \ contained
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
166 \ keepend
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
167 \ contains=tsxAttribPunct,tsxAttribHook
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
168 \ display
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
169
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
170 syntax match tsxAttribPunct +[:.]+ contained display
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
171
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
172 " <tag id="sample">
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
173 " ~
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
174 syntax match tsxEqual +=+ contained display
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
175
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
176 " <tag id="sample">
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
177 " s~~~~~~e
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
178 syntax region tsxString contained start=+"+ end=+"+ contains=tsxEntity,@Spell display
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
179
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
180 " <tag id=`sample${var}`>
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
181 syntax region tsxString contained start=+`+ end=+`+ contains=tsxEntity,@Spell display
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
182
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
183 " <tag id='sample'>
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
184 " s~~~~~~e
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
185 syntax region tsxString contained start=+'+ end=+'+ contains=tsxEntity,@Spell display
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
186
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
187 syntax match tsxIfOperator +?+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
188 syntax match tsxNotOperator +!+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
189 syntax match tsxElseOperator +:+
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
190
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
191 " highlight def link tsxTagName htmlTagName
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
192 highlight def link tsxTagName xmlTagName
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
193 highlight def link tsxTag htmlTag
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
194 highlight def link tsxCloseTag xmlEndTag
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
195 highlight def link tsxRegionEnd xmlEndTag
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
196 highlight def link tsxEqual htmlTag
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
197 highlight def link tsxString String
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
198 highlight def link tsxNameSpace Function
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
199 highlight def link tsxComment Error
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
200 highlight def link tsxAttrib htmlArg
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
201 highlight def link tsxCloseString htmlTagName
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
202 highlight def link tsxAttributeBraces htmlTag
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
203 highlight def link tsxAttributeComment Comment
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
204 highlight def link tsxColon typescriptEndColons
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
205
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
206 highlight def link tsxGenerics typescriptEndColons
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
207 highlight def link tsGenerics tsxTypeBraces
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
208
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
209 highlight def link tsxIfOperator typescriptEndColons
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
210 highlight def link tsxNotOperator typescriptEndColons
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
211 highlight def link tsxElseOperator typescriptEndColons
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
212 highlight def link tsxTypeBraces htmlTag
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
213 highlight def link tsxTypes typescriptEndColons
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
214
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
215 " Custom React Highlights
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
216 syn keyword ReactState state nextState prevState setState
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
217 " Then EITHER (define your own colour scheme):
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
218 " OR (make the colour scheme match an existing one):
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
219 " hi link ReactKeywords typescriptRComponent
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
220 syn keyword ReactProps props defaultProps ownProps nextProps prevProps
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
221 syn keyword Events e event target value
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
222 syn keyword ReduxKeywords dispatch payload
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
223 syn keyword ReduxHooksKeywords useState useEffect useMemo useCallback
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
224 syn keyword WebBrowser window localStorage
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
225 syn keyword ReactLifeCycleMethods componentWillMount shouldComponentUpdate componentWillUpdate componentDidUpdate componentWillReceiveProps componentWillUnmount componentDidMount
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
226
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
227 let b:current_syntax = 'typescript.tsx'
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
228
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
229 let &cpo = s:tsx_cpo
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
230 unlet s:tsx_cpo
32fefb633034 Add support for tsx
nanaya <me@nanaya.pro>
parents:
diff changeset
231