xref: /vim-8.2.3635/runtime/syntax/css.vim (revision 1d59aa1f)
1" Vim syntax file
2" Language:     Cascading Style Sheets
3" Previous Contributor List:
4"               Jules Wang      <[email protected]>
5"               Claudio Fleiner <[email protected]> (Maintainer)
6"               Yeti            (Add full CSS2, HTML4 support)
7"               Nikolai Weibull (Add CSS2 support)
8" URL:          https://github.com/jsit/css.vim
9" Maintainer:   Jay Sitter <[email protected]>
10" Last Change:  2019 Jul. 29
11
12" quit when a syntax file was already loaded
13if !exists("main_syntax")
14  if exists("b:current_syntax")
15    finish
16  endif
17  let main_syntax = 'css'
18elseif exists("b:current_syntax") && b:current_syntax == "css"
19  finish
20endif
21
22let s:cpo_save = &cpo
23set cpo&vim
24
25syn case ignore
26
27" HTML4 tags
28syn keyword cssTagName abbr address area a b base
29syn keyword cssTagName bdo blockquote body br button
30syn keyword cssTagName caption cite code col colgroup dd del
31syn keyword cssTagName dfn div dl dt em fieldset form
32syn keyword cssTagName h1 h2 h3 h4 h5 h6 head hr html img i
33syn keyword cssTagName iframe input ins isindex kbd label legend li
34syn keyword cssTagName link map menu meta noscript ol optgroup
35syn keyword cssTagName option p param pre q s samp script small
36syn keyword cssTagName span strong sub sup tbody td
37syn keyword cssTagName textarea tfoot th thead title tr ul u var
38syn keyword cssTagName object svg
39syn match   cssTagName /\<select\>\|\<style\>\|\<table\>/
40
41" 34 HTML5 tags
42syn keyword cssTagName article aside audio bdi canvas command data
43syn keyword cssTagName datalist details dialog embed figcaption figure footer
44syn keyword cssTagName header hgroup keygen main mark menuitem meter nav
45syn keyword cssTagName output progress rt rp ruby section
46syn keyword cssTagName source summary time track video wbr
47
48" Tags not supported in HTML5
49" acronym applet basefont big center dir
50" font frame frameset noframes strike tt
51
52syn match cssTagName "\*"
53
54" selectors
55syn match cssSelectorOp "[,>+~]"
56syn match cssSelectorOp2 "[~|^$*]\?=" contained
57syn region cssAttributeSelector matchgroup=cssSelectorOp start="\[" end="]" contains=cssUnicodeEscape,cssSelectorOp2,cssStringQ,cssStringQQ
58
59" .class and #id
60syn match cssClassName "\.-\=[A-Za-z_][A-Za-z0-9_-]*" contains=cssClassNameDot
61syn match cssClassNameDot contained '\.'
62
63try
64syn match cssIdentifier "#[A-Za-z�-�_@][A-Za-z�-�0-9_@-]*"
65catch /^.*/
66syn match cssIdentifier "#[A-Za-z_@][A-Za-z0-9_@-]*"
67endtry
68
69" digits
70syn match cssValueInteger contained "[-+]\=\d\+" contains=cssUnitDecorators
71syn match cssValueNumber contained "[-+]\=\d\+\(\.\d*\)\=" contains=cssUnitDecorators
72syn match cssValueLength contained "[-+]\=\d\+\(\.\d*\)\=\(mm\|cm\|in\|pt\|pc\|em\|ex\|px\|rem\|dpi\|dppx\|dpcm\|fr\|vw\|vh\|vmin\|vmax\|ch\)\>" contains=cssUnitDecorators
73syn match cssValueLength contained "[-+]\=\d\+\(\.\d*\)\=%" contains=cssUnitDecorators
74syn match cssValueAngle contained "[-+]\=\d\+\(\.\d*\)\=\(deg\|grad\|rad\)\>" contains=cssUnitDecorators
75syn match cssValueTime contained "+\=\d\+\(\.\d*\)\=\(ms\|s\)\>" contains=cssUnitDecorators
76syn match cssValueFrequency contained "+\=\d\+\(\.\d*\)\=\(Hz\|kHz\)\>" contains=cssUnitDecorators
77
78" The 16 basic color names
79syn keyword cssColor contained aqua black blue fuchsia gray green lime maroon navy olive purple red silver teal yellow
80
81" 130 more color names
82syn keyword cssColor contained aliceblue antiquewhite aquamarine azure
83syn keyword cssColor contained beige bisque blanchedalmond blueviolet brown burlywood
84syn keyword cssColor contained cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan
85syn match cssColor contained /\<dark\(blue\|cyan\|goldenrod\|gray\|green\|grey\|khaki\)\>/
86syn match cssColor contained /\<dark\(magenta\|olivegreen\|orange\|orchid\|red\|salmon\|seagreen\)\>/
87syn match cssColor contained /\<darkslate\(blue\|gray\|grey\)\>/
88syn match cssColor contained /\<dark\(turquoise\|violet\)\>/
89syn keyword cssColor contained deeppink deepskyblue dimgray dimgrey dodgerblue firebrick
90syn keyword cssColor contained floralwhite forestgreen gainsboro ghostwhite gold
91syn keyword cssColor contained goldenrod greenyellow grey honeydew hotpink
92syn keyword cssColor contained indianred indigo ivory khaki lavender lavenderblush lawngreen
93syn keyword cssColor contained lemonchiffon limegreen linen magenta
94syn match cssColor contained /\<light\(blue\|coral\|cyan\|goldenrodyellow\|gray\|green\)\>/
95syn match cssColor contained /\<light\(grey\|pink\|salmon\|seagreen\|skyblue\|yellow\)\>/
96syn match cssColor contained /\<light\(slategray\|slategrey\|steelblue\)\>/
97syn match cssColor contained /\<medium\(aquamarine\|blue\|orchid\|purple\|seagreen\)\>/
98syn match cssColor contained /\<medium\(slateblue\|springgreen\|turquoise\|violetred\)\>/
99syn keyword cssColor contained midnightblue mintcream mistyrose moccasin navajowhite
100syn keyword cssColor contained oldlace olivedrab orange orangered orchid
101syn match cssColor contained /\<pale\(goldenrod\|green\|turquoise\|violetred\)\>/
102syn keyword cssColor contained papayawhip peachpuff peru pink plum powderblue
103syn keyword cssColor contained rosybrown royalblue rebeccapurple saddlebrown salmon
104syn keyword cssColor contained sandybrown seagreen seashell sienna skyblue slateblue
105syn keyword cssColor contained slategray slategrey snow springgreen steelblue tan
106syn keyword cssColor contained thistle tomato turquoise violet wheat
107syn keyword cssColor contained whitesmoke yellowgreen
108
109" FIXME: These are actually case-insensitive too, but (a) specs recommend using
110" mixed-case (b) it's hard to highlight the word `Background' correctly in
111" all situations
112syn case match
113syn keyword cssColor contained ActiveBorder ActiveCaption AppWorkspace ButtonFace ButtonHighlight ButtonShadow ButtonText CaptionText GrayText Highlight HighlightText InactiveBorder InactiveCaption InactiveCaptionText InfoBackground InfoText Menu MenuText Scrollbar ThreeDDarkShadow ThreeDFace ThreeDHighlight ThreeDLightShadow ThreeDShadow Window WindowFrame WindowText Background
114syn case ignore
115
116syn match cssImportant contained "!\s*important\>"
117syn match cssCustomProp contained "--[a-zA-Z0-9-_]*"
118
119syn match cssColor contained "\<transparent\>"
120syn match cssColor contained "\<currentColor\>"
121syn match cssColor contained "\<white\>"
122syn match cssColor contained "#\x\{3,4\}\>" contains=cssUnitDecorators
123syn match cssColor contained "#\x\{6\}\>" contains=cssUnitDecorators
124syn match cssColor contained "#\x\{8\}\>" contains=cssUnitDecorators
125
126syn region cssURL contained matchgroup=cssFunctionName start="\<\(uri\|url\|local\|format\)\s*(" end=")" contains=cssStringQ,cssStringQQ oneline
127syn region cssFunction contained matchgroup=cssFunctionName start="\<\(var\|calc\)\s*(" end=")" contains=cssCustomProp,cssValue.*,cssFunction,cssColor,cssStringQ,cssStringQQ oneline
128syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgb\|clip\|attr\|counter\|rect\|cubic-bezier\|steps\)\s*(" end=")" oneline  contains=cssValueInteger,cssValueNumber,cssValueLength,cssFunctionComma
129syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgba\|hsl\|hsla\|color-stop\|from\|to\)\s*(" end=")" oneline  contains=cssColor,cssValueInteger,cssValueNumber,cssValueLength,cssFunctionComma,cssFunction
130syn region cssFunction contained matchgroup=cssFunctionName start="\<\(linear-\|radial-\)\=\gradient\s*(" end=")" oneline  contains=cssColor,cssValueInteger,cssValueNumber,cssValueLength,cssFunction,cssGradientAttr,cssFunctionComma
131syn region cssFunction contained matchgroup=cssFunctionName start="\<\(matrix\(3d\)\=\|scale\(3d\|X\|Y\|Z\)\=\|translate\(3d\|X\|Y\|Z\)\=\|skew\(X\|Y\)\=\|rotate\(3d\|X\|Y\|Z\)\=\|perspective\)\s*(" end=")" oneline contains=cssValueInteger,cssValueNumber,cssValueLength,cssValueAngle,cssFunctionComma
132syn region cssFunction contained matchgroup=cssFunctionName start="\<\(blur\|brightness\|contrast\|drop-shadow\|grayscale\|hue-rotate\|invert\|opacity\|saturate\|sepia\)\s*(" end=")" oneline contains=cssValueInteger,cssValueNumber,cssValueLength,cssValueAngle,cssFunctionComma
133syn keyword cssGradientAttr contained top bottom left right cover center middle ellipse at
134syn match cssFunctionComma contained ","
135
136" Common Prop and Attr
137syn keyword cssCommonAttr contained auto none inherit all default normal
138syn keyword cssCommonAttr contained top bottom center stretch hidden visible
139syn match cssCommonAttr contained "\<\(max-\|min-\|fit-\)content\>"
140"------------------------------------------------
141" CSS Animations
142" http://www.w3.org/TR/css3-animations/
143syn match cssAnimationProp contained "\<animation\(-\(delay\|direction\|duration\|fill-mode\|name\|play-state\|timing-function\|iteration-count\)\)\=\>"
144
145" animation-direction attributes
146syn keyword cssAnimationAttr contained alternate reverse
147syn match cssAnimationAttr contained "\<alternate-reverse\>"
148
149" animation-fill-mode attributes
150syn keyword cssAnimationAttr contained forwards backwards both
151
152" animation-play-state attributes
153syn keyword cssAnimationAttr contained running paused
154
155" animation-iteration-count attributes
156syn keyword cssAnimationAttr contained infinite
157"------------------------------------------------
158"  CSS Backgrounds and Borders Module Level 3
159"  http://www.w3.org/TR/css3-background/
160syn match cssBackgroundProp contained "\<background\(-\(attachment\|clip\|color\|image\|origin\|position\|repeat\|size\)\)\=\>"
161" background-attachment attributes
162syn keyword cssBackgroundAttr contained scroll fixed local
163
164" background-position attributes
165syn keyword cssBackgroundAttr contained left center right top bottom
166
167" background-repeat attributes
168syn match cssBackgroundAttr contained "\<no-repeat\>"
169syn match cssBackgroundAttr contained "\<repeat\(-[xy]\)\=\>"
170
171" background-size attributes
172syn keyword cssBackgroundAttr contained cover contain
173
174syn match cssBorderProp contained "\<border\(-\(top\|right\|bottom\|left\)\)\=\(-\(width\|color\|style\)\)\=\>"
175syn match cssBorderProp contained "\<border\(-\(top\|bottom\)-\(left\|right\)\)\=-radius\>"
176syn match cssBorderProp contained "\<border-image\(-\(outset\|repeat\|slice\|source\|width\)\)\=\>"
177syn match cssBorderProp contained "\<box-decoration-break\>"
178syn match cssBorderProp contained "\<box-shadow\>"
179
180" border-image attributes
181syn keyword cssBorderAttr contained stretch round fill
182
183" border-style attributes
184syn keyword cssBorderAttr contained dotted dashed solid double groove ridge inset outset
185
186" border-width attributes
187syn keyword cssBorderAttr contained thin thick medium
188
189" box-decoration-break attributes
190syn keyword cssBorderAttr contained clone slice
191"------------------------------------------------
192
193syn match cssBoxProp contained "\<padding\(-\(top\|right\|bottom\|left\)\)\=\>"
194syn match cssBoxProp contained "\<margin\(-\(top\|right\|bottom\|left\)\)\=\>"
195syn match cssBoxProp contained "\<overflow\(-\(x\|y\|style\)\)\=\>"
196syn match cssBoxProp contained "\<rotation\(-point\)\=\>"
197syn keyword cssBoxAttr contained visible hidden scroll auto
198syn match cssBoxAttr contained "\<no-\(display\|content\)\>"
199
200syn keyword cssCascadeProp contained all
201syn keyword cssCascadeAttr contained initial unset revert
202
203syn keyword cssColorProp contained opacity
204syn match cssColorProp contained "\<color-profile\>"
205syn match cssColorProp contained "\<rendering-intent\>"
206
207
208syn match cssDimensionProp contained "\<\(min\|max\)-\(width\|height\)\>"
209syn keyword cssDimensionProp contained height
210syn keyword cssDimensionProp contained width
211
212" CSS Flexible Box Layout Module Level 1
213" http://www.w3.org/TR/css3-flexbox/
214" CSS Box Alignment Module Level 3
215" http://www.w3.org/TR/css-align-3/
216syn match cssFlexibleBoxProp contained "\<flex\(-\(direction\|wrap\|flow\|grow\|shrink\|basis\)\)\=\>"
217syn match cssFlexibleBoxProp contained "\<\(align\|justify\)\(-\(items\|self\|content\)\)\=\>"
218syn keyword cssFlexibleBoxProp contained order
219
220syn match cssFlexibleBoxAttr contained "\<\(row\|column\|wrap\)\(-reverse\)\=\>"
221syn keyword cssFlexibleBoxAttr contained nowrap stretch baseline center
222syn match cssFlexibleBoxAttr contained "\<flex\(-\(start\|end\)\)\=\>"
223syn match cssFlexibleBoxAttr contained "\<space\(-\(between\|around\)\)\=\>"
224
225" CSS Fonts Module Level 3
226" http://www.w3.org/TR/css-fonts-3/
227syn match cssFontProp contained "\<font\(-\(family\|\|feature-settings\|kerning\|language-override\|size\(-adjust\)\=\|stretch\|style\|synthesis\|variant\(-\(alternates\|caps\|east-asian\|ligatures\|numeric\|position\)\)\=\|weight\)\)\=\>"
228
229" font attributes
230syn keyword cssFontAttr contained icon menu caption
231syn match cssFontAttr contained "\<message-box\>"
232syn match cssFontAttr contained "\<status-bar\>"
233syn keyword cssFontAttr contained larger smaller
234syn match cssFontAttr contained "\<\(x\{1,2\}-\)\=\(large\|small\)\>"
235syn match cssFontAttr contained "\<small-\(caps\|caption\)\>"
236" font-family attributes
237syn match cssFontAttr contained "\<\(sans-\)\=serif\>"
238syn keyword cssFontAttr contained Antiqua Arial Black Book Charcoal Comic Courier Dingbats Gadget Geneva Georgia Grande Helvetica Impact Linotype Lucida MS Monaco Neue New Palatino Roboto Roman Symbol Tahoma Times Trebuchet Verdana Webdings Wingdings York Zapf
239syn keyword cssFontAttr contained cursive fantasy monospace
240" font-feature-settings attributes
241syn keyword cssFontAttr contained on off
242" font-stretch attributes
243syn match cssFontAttr contained "\<\(\(ultra\|extra\|semi\)-\)\=\(condensed\|expanded\)\>"
244" font-style attributes
245syn keyword cssFontAttr contained italic oblique
246" font-synthesis attributes
247syn keyword cssFontAttr contained weight style
248" font-weight attributes
249syn keyword cssFontAttr contained bold bolder lighter
250" TODO: font-variant-* attributes
251"------------------------------------------------
252
253" Webkit specific property/attributes
254syn match cssFontProp contained "\<font-smooth\>"
255syn match cssFontAttr contained "\<\(subpixel-\)\=\antialiased\>"
256
257
258" CSS Multi-column Layout Module
259" http://www.w3.org/TR/css3-multicol/
260syn match cssMultiColumnProp contained "\<break-\(after\|before\|inside\)\>"
261syn match cssMultiColumnProp contained "\<column-\(count\|fill\|gap\|rule\(-\(color\|style\|width\)\)\=\|span\|width\)\>"
262syn keyword cssMultiColumnProp contained columns
263syn keyword cssMultiColumnAttr contained balance medium
264syn keyword cssMultiColumnAttr contained always left right page column
265syn match cssMultiColumnAttr contained "\<avoid\(-\(page\|column\)\)\=\>"
266
267" http://www.w3.org/TR/css3-break/#page-break
268syn match cssMultiColumnProp contained "\<page\(-break-\(before\|after\|inside\)\)\=\>"
269
270" http://www.w3.org/TR/SVG11/interact.html
271syn match cssInteractProp contained "\<pointer-events\>"
272syn match cssInteractAttr contained "\<\(visible\)\=\(Painted\|Fill\|Stroke\)\=\>"
273
274" TODO find following items in w3c docs.
275syn keyword cssGeneratedContentProp contained quotes crop
276syn match cssGeneratedContentProp contained "\<counter-\(reset\|increment\)\>"
277syn match cssGeneratedContentProp contained "\<move-to\>"
278syn match cssGeneratedContentProp contained "\<page-policy\>"
279syn match cssGeneratedContentAttr contained "\<\(no-\)\=\(open\|close\)-quote\>"
280
281" https://www.w3.org/TR/css-grid-1/
282syn match cssGridProp contained "\<grid\>"
283syn match cssGridProp contained "\<grid-template\(-\(columns\|rows\|areas\)\)\=\>"
284syn match cssGridProp contained "\<grid-\(column\|row\)\(-\(start\|end\|gap\)\)\=\>"
285syn match cssGridProp contained "\<grid-\(area\|gap\)\>"
286syn match cssGridProp contained "\<grid-auto-\(flow\|rows\|columns\)\>"
287
288syn match cssHyerlinkProp contained "\<target\(-\(name\|new\|position\)\)\=\>"
289
290syn match cssListProp contained "\<list-style\(-\(type\|position\|image\)\)\=\>"
291syn match cssListAttr contained "\<\(lower\|upper\)-\(roman\|alpha\|greek\|latin\)\>"
292syn match cssListAttr contained "\<\(hiragana\|katakana\)\(-iroha\)\=\>"
293syn match cssListAttr contained "\<\(decimal\(-leading-zero\)\=\|cjk-ideographic\)\>"
294syn keyword cssListAttr contained disc circle square hebrew armenian georgian
295syn keyword cssListAttr contained inside outside
296
297syn keyword cssPositioningProp contained bottom clear clip display float left
298syn keyword cssPositioningProp contained position right top visibility
299syn match cssPositioningProp contained "\<z-index\>"
300syn keyword cssPositioningAttr contained block compact grid
301syn match cssPositioningAttr contained "\<table\(-\(row-group\|\(header\|footer\)-group\|row\|column\(-group\)\=\|cell\|caption\)\)\=\>"
302syn keyword cssPositioningAttr contained left right both
303syn match cssPositioningAttr contained "\<list-item\>"
304syn match cssPositioningAttr contained "\<inline\(-\(block\|box\|table\|grid\|flex\)\)\=\>"
305syn match cssPositioningAttr contained "\<flow\(-root\)\=\>"
306syn keyword cssPositioningAttr contained static relative absolute fixed subgrid
307
308syn keyword cssPrintAttr contained landscape portrait crop cross always
309
310syn match cssTableProp contained "\<\(caption-side\|table-layout\|border-collapse\|border-spacing\|empty-cells\)\>"
311syn keyword cssTableAttr contained fixed collapse separate show hide once always
312
313
314syn keyword cssTextProp contained color direction hyphens
315syn match cssTextProp "\<\(\(word\|letter\)-spacing\|text\(-\(decoration\|transform\|align\|index\|shadow\)\)\=\|vertical-align\|unicode-bidi\|line-height\)\>"
316syn match cssTextProp contained "\<text-\(justify\|outline\|warp\|align-last\|size-adjust\|rendering\|stroke\|indent\)\>"
317syn match cssTextProp contained "\<\(word\|line\)-break\|\(overflow\|word\)-wrap\>"
318syn match cssTextProp contained "\<white-space\>"
319syn match cssTextProp contained "\<hanging-punctuation\>"
320syn match cssTextProp contained "\<tab-size\>"
321syn match cssTextProp contained "\<punctuation-trim\>"
322syn match cssTextAttr contained "\<line-through\>"
323syn match cssTextAttr contained "\<\(text-\)\=\(top\|bottom\)\>"
324syn keyword cssTextAttr contained ltr rtl embed nowrap
325syn keyword cssTextAttr contained underline overline blink sub super middle
326syn keyword cssTextAttr contained capitalize uppercase lowercase
327syn keyword cssTextAttr contained justify baseline sub super
328syn keyword cssTextAttr contained optimizeLegibility optimizeSpeed geometricPrecision
329syn match cssTextAttr contained "\<pre\(-\(line\|wrap\)\)\=\>"
330syn match cssTextAttr contained "\<\(allow\|force\)-end\>"
331syn keyword cssTextAttr contained start end adjacent
332syn match cssTextAttr contained "\<inter-\(word\|ideographic\|cluster\)\>"
333syn keyword cssTextAttr contained distribute kashida first last
334syn keyword cssTextAttr contained clip ellipsis unrestricted suppress
335syn match cssTextAttr contained "\<break-all\>"
336syn match cssTextAttr contained "\<break-word\>"
337syn keyword cssTextAttr contained manual
338syn match cssTextAttr contained "\<bidi-override\>"
339
340syn match cssTransformProp contained "\<transform\(-\(origin\|style\)\)\=\>"
341syn match cssTransformProp contained "\<perspective\(-origin\)\=\>"
342syn match cssTransformProp contained "\<backface-visibility\>"
343
344" CSS Transitions
345" http://www.w3.org/TR/css3-transitions/
346syn match cssTransitionProp contained "\<transition\(-\(delay\|duration\|property\|timing-function\)\)\=\>"
347
348" transition-time-function attributes
349syn match cssTransitionAttr contained "\<linear\(-gradient\)\@!\>"
350syn match cssTransitionAttr contained "\<ease\(-\(in-out\|out\|in\)\)\=\>"
351syn match cssTransitionAttr contained "\<step\(-start\|-end\)\=\>"
352"------------------------------------------------
353" CSS Basic User Interface Module Level 3 (CSS3 UI)
354" http://www.w3.org/TR/css3-ui/
355syn match cssUIProp contained "\<box-sizing\>"
356syn match cssUIAttr contained "\<\(content\|padding\|border\)\(-box\)\=\>"
357
358syn keyword cssUIProp contained cursor
359syn match cssUIAttr contained "\<\(\([ns]\=[ew]\=\)\|col\|row\|nesw\|nwse\)-resize\>"
360syn keyword cssUIAttr contained crosshair help move pointer alias copy
361syn keyword cssUIAttr contained progress wait text cell move
362syn match cssUIAttr contained "\<context-menu\>"
363syn match cssUIAttr contained "\<no-drop\>"
364syn match cssUIAttr contained "\<not-allowed\>"
365syn match cssUIAttr contained "\<all-scroll\>"
366syn match cssUIAttr contained "\<\(vertical-\)\=text\>"
367syn match cssUIAttr contained "\<zoom\(-in\|-out\)\=\>"
368
369syn match cssUIProp contained "\<ime-mode\>"
370syn keyword cssUIAttr contained active inactive disabled
371
372syn match cssUIProp contained "\<nav-\(down\|index\|left\|right\|up\)\=\>"
373syn match cssUIProp contained "\<outline\(-\(width\|style\|color\|offset\)\)\=\>"
374syn keyword cssUIAttr contained invert
375
376syn keyword cssUIProp contained icon resize
377syn keyword cssUIAttr contained both horizontal vertical
378
379syn match cssUIProp contained "\<text-overflow\>"
380syn keyword cssUIAttr contained clip ellipsis
381
382syn match cssUIProp contained "\<image-rendering\>"
383syn keyword cssUIAttr contained pixellated
384syn match cssUIAttr contained "\<crisp-edges\>"
385
386"------------------------------------------------
387" Webkit/iOS specific attributes
388syn match cssUIAttr contained '\<preserve-3d\>'
389" IE specific attributes
390syn match cssIEUIAttr contained '\<bicubic\>'
391
392" Webkit/iOS specific properties
393syn match cssUIProp contained '\<tap-highlight-color\|user-select\|touch-callout\>'
394" IE specific properties
395syn match cssIEUIProp contained '\<interpolation-mode\|zoom\|filter\>'
396
397" Webkit/Firebox specific properties/attributes
398syn keyword cssUIProp contained appearance
399syn keyword cssUIAttr contained window button field icon document menu
400
401
402syn match cssAuralProp contained "\<\(pause\|cue\)\(-\(before\|after\)\)\=\>"
403syn match cssAuralProp contained "\<\(play-during\|speech-rate\|voice-family\|pitch\(-range\)\=\|speak\(-\(punctuation\|numeral\|header\)\)\=\)\>"
404syn keyword cssAuralProp contained volume during azimuth elevation stress richness
405syn match cssAuralAttr contained "\<\(x-\)\=\(soft\|loud\)\>"
406syn keyword cssAuralAttr contained silent
407syn match cssAuralAttr contained "\<spell-out\>"
408syn keyword cssAuralAttr contained non mix
409syn match cssAuralAttr contained "\<\(left\|right\)-side\>"
410syn match cssAuralAttr contained "\<\(far\|center\)-\(left\|center\|right\)\>"
411syn keyword cssAuralAttr contained leftwards rightwards behind
412syn keyword cssAuralAttr contained below level above lower higher
413syn match cssAuralAttr contained "\<\(x-\)\=\(slow\|fast\|low\|high\)\>"
414syn keyword cssAuralAttr contained faster slower
415syn keyword cssAuralAttr contained male female child code digits continuous
416
417" mobile text
418syn match cssMobileTextProp contained "\<text-size-adjust\>"
419
420syn keyword cssMediaProp contained width height orientation scan
421syn match cssMediaProp contained /\(\(max\|min\)-\)\=\(\(device\)-\)\=aspect-ratio/
422syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-pixel-ratio/
423syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-\(height\|width\)/
424syn match cssMediaProp contained /\(\(max\|min\)-\)\=\(height\|width\|resolution\|monochrome\|color\(-index\)\=\)/
425syn keyword cssMediaAttr contained portrait landscape progressive interlace
426syn match cssKeyFrameProp contained /\(\d\+\(\.\d\+\)\?%\|\(\<from\|to\>\)\)/ nextgroup=cssDefinition
427syn match cssPageMarginProp /@\(\(top\|left\|right\|bottom\)-\(left\|center\|right\|middle\|bottom\)\)\(-corner\)\=/ contained nextgroup=cssDefinition
428syn keyword cssPageProp contained content size
429syn keyword cssPageProp contained orphans widows
430syn keyword cssFontDescriptorProp contained src
431syn match cssFontDescriptorProp contained "\<unicode-range\>"
432" unicode-range attributes
433syn match cssFontDescriptorAttr contained "U+[0-9A-Fa-f?]\+"
434syn match cssFontDescriptorAttr contained "U+\x\+-\x\+"
435
436syn match cssBraces contained "[{}]"
437syn match cssError contained "{@<>"
438syn region cssDefinition transparent matchgroup=cssBraces start='{' end='}' contains=cssTagName,cssAttributeSelector,cssClassName,cssIdentifier,cssAtRule,cssAttrRegion,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssCustomProp,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssHacks,cssNoise fold
439syn match cssBraceError "}"
440syn match cssAttrComma ","
441
442" Pseudo class
443" http://www.w3.org/TR/css3-selectors/
444syn match cssPseudoClass ":[A-Za-z0-9_-]*" contains=cssNoise,cssPseudoClassId,cssUnicodeEscape,cssVendor,cssPseudoClassFn
445syn keyword cssPseudoClassId contained link visited active hover before after left right
446syn keyword cssPseudoClassId contained root empty target enable disabled checked invalid
447syn match cssPseudoClassId contained "\<first-\(line\|letter\)\>"
448syn match cssPseudoClassId contained "\<\(first\|last\|only\)-\(of-type\|child\)\>"
449syn region cssPseudoClassFn contained matchgroup=cssFunctionName start="\<\(not\|lang\|\(nth\|nth-last\)-\(of-type\|child\)\)(" end=")" contains=cssStringQ,cssStringQQ
450" ------------------------------------
451" Vendor specific properties
452syn match cssPseudoClassId contained  "\<selection\>"
453syn match cssPseudoClassId contained  "\<focus\(-inner\)\=\>"
454syn match cssPseudoClassId contained  "\<\(input-\)\=placeholder\>"
455
456" Misc highlight groups
457syntax match cssUnitDecorators /\(#\|-\|+\|%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|ch\|rem\|vh\|vw\|vmin\|vmax\|dpi\|dppx\|dpcm\|Hz\|kHz\|s\|ms\|deg\|grad\|rad\)/ contained
458syntax match cssNoise contained /\(:\|;\|\/\)/
459
460" Comment
461syn region cssComment start="/\*" end="\*/" contains=@Spell fold
462
463syn match cssUnicodeEscape "\\\x\{1,6}\s\?"
464syn match cssSpecialCharQQ +\\\\\|\\"+ contained
465syn match cssSpecialCharQ +\\\\\|\\'+ contained
466syn region cssStringQQ start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=cssUnicodeEscape,cssSpecialCharQQ
467syn region cssStringQ start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=cssUnicodeEscape,cssSpecialCharQ
468
469" Vendor Prefix
470syn match cssVendor contained "-\(webkit\|moz\|o\|ms\)-"
471
472" Various CSS Hack characters
473" In earlier versions of IE (6 and 7), one can prefix property names
474" with a _ or * to isolate those definitions to particular versions of IE
475" This is purely decorative and therefore we assign to the same highlight
476" group to cssVendor, for more information:
477" http://www.paulirish.com/2009/browser-specific-css-hacks/
478syn match cssHacks contained /\(_\|*\)/
479
480" Attr Enhance
481" Some keywords are both Prop and Attr, so we have to handle them
482" cssPseudoClassId is hidden by cssAttrRegion, so we add it here. see #69
483syn region cssAttrRegion start=/:/ end=/\ze\(;\|)\|}\|{\)/ contained contains=cssPseudoClassId,css.*Attr,cssColor,cssImportant,cssValue.*,cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,cssError,cssAttrComma,cssNoise
484
485" Hack for transition
486" 'transition' has Props after ':'.
487syn region cssAttrRegion start=/transition\s*:/ end=/\ze\(;\|)\|}\)/ contained contains=css.*Prop,css.*Attr,cssColor,cssImportant,cssValue.*,cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,cssError,cssAttrComma,cssNoise
488
489syn match cssAtKeyword /@\(font-face\|media\|keyframes\|import\|charset\|namespace\|page\|supports\)/
490
491syn keyword cssAtRuleLogical only not and contained
492
493" @media
494" Reference: http://www.w3.org/TR/css3-mediaqueries/
495syn region cssAtRule start=/@media\>/ end=/\ze{/ skipwhite skipnl matchgroup=cssAtKeyword contains=cssMediaProp,cssValueLength,cssAtRuleLogical,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType,cssComment,cssCustomProp,cssFunctionName nextgroup=cssDefinition
496syn keyword cssMediaType contained screen print aural braille embossed handheld projection tty tv speech all contained
497
498" @page
499" http://www.w3.org/TR/css3-page/
500syn region cssAtRule start=/@page\>/ end=/\ze{/ skipwhite skipnl matchgroup=cssAtKeyword contains=cssPagePseudo,cssComment nextgroup=cssDefinition
501syn match cssPagePseudo /:\(left\|right\|first\|blank\)/ contained skipwhite skipnl
502" @keyframe
503" http://www.w3.org/TR/css3-animations/#keyframes
504syn region cssAtRule start=/@\(-[a-z]\+-\)\=keyframes\>/ end=/\ze{/ skipwhite skipnl matchgroup=cssAtKeyword contains=cssVendor,cssComment nextgroup=cssDefinition
505
506syn region cssAtRule start=/@import\>/    end=/\ze;/ contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssAtKeyword,cssURL,cssMediaProp,cssValueLength,cssAtRuleLogical,cssValueInteger,cssMediaAttr,cssMediaType
507syn region cssAtRule start=/@charset\>/   end=/\ze;/ contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssAtKeyword
508syn region cssAtRule start=/@namespace\>/ end=/\ze;/ contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssAtKeyword
509
510" @supports
511" https://www.w3.org/TR/css3-conditional/#at-supports
512syn region cssAtRule start=/@supports\>/ end=/\ze{/ skipwhite skipnl contains=cssAtRuleLogical,cssAttrRegion,css.*Prop,cssValue.*,cssVendor,cssAtKeyword,cssComment nextgroup=cssDefinition
513
514
515if main_syntax == "css"
516  syn sync minlines=10
517endif
518
519" Define the default highlighting.
520" Only when an item doesn't have highlighting yet
521
522hi def link cssComment Comment
523hi def link cssVendor Comment
524hi def link cssHacks Comment
525hi def link cssTagName Statement
526hi def link cssDeprecated Error
527hi def link cssSelectorOp Special
528hi def link cssSelectorOp2 Special
529hi def link cssAttrComma Special
530
531hi def link cssAnimationProp cssProp
532hi def link cssBackgroundProp cssProp
533hi def link cssBorderProp cssProp
534hi def link cssBoxProp cssProp
535hi def link cssCascadeProp cssProp
536hi def link cssColorProp cssProp
537hi def link cssContentForPagedMediaProp cssProp
538hi def link cssDimensionProp cssProp
539hi def link cssFlexibleBoxProp cssProp
540hi def link cssFontProp cssProp
541hi def link cssGeneratedContentProp cssProp
542hi def link cssGridProp cssProp
543hi def link cssHyerlinkProp cssProp
544hi def link cssInteractProp cssProp
545hi def link cssLineboxProp cssProp
546hi def link cssListProp cssProp
547hi def link cssMarqueeProp cssProp
548hi def link cssMultiColumnProp cssProp
549hi def link cssPagedMediaProp cssProp
550hi def link cssPositioningProp cssProp
551hi def link cssPrintProp cssProp
552hi def link cssRubyProp cssProp
553hi def link cssSpeechProp cssProp
554hi def link cssTableProp cssProp
555hi def link cssTextProp cssProp
556hi def link cssTransformProp cssProp
557hi def link cssTransitionProp cssProp
558hi def link cssUIProp cssProp
559hi def link cssIEUIProp cssProp
560hi def link cssAuralProp cssProp
561hi def link cssRenderProp cssProp
562hi def link cssMobileTextProp cssProp
563
564hi def link cssAnimationAttr cssAttr
565hi def link cssBackgroundAttr cssAttr
566hi def link cssBorderAttr cssAttr
567hi def link cssBoxAttr cssAttr
568hi def link cssContentForPagedMediaAttr cssAttr
569hi def link cssDimensionAttr cssAttr
570hi def link cssFlexibleBoxAttr cssAttr
571hi def link cssFontAttr cssAttr
572hi def link cssGeneratedContentAttr cssAttr
573hi def link cssGridAttr cssAttr
574hi def link cssHyerlinkAttr cssAttr
575hi def link cssInteractAttr cssAttr
576hi def link cssLineboxAttr cssAttr
577hi def link cssListAttr cssAttr
578hi def link cssMarginAttr cssAttr
579hi def link cssMarqueeAttr cssAttr
580hi def link cssMultiColumnAttr cssAttr
581hi def link cssPaddingAttr cssAttr
582hi def link cssPagedMediaAttr cssAttr
583hi def link cssPositioningAttr cssAttr
584hi def link cssGradientAttr cssAttr
585hi def link cssPrintAttr cssAttr
586hi def link cssRubyAttr cssAttr
587hi def link cssSpeechAttr cssAttr
588hi def link cssTableAttr cssAttr
589hi def link cssTextAttr cssAttr
590hi def link cssTransformAttr cssAttr
591hi def link cssTransitionAttr cssAttr
592hi def link cssUIAttr cssAttr
593hi def link cssIEUIAttr cssAttr
594hi def link cssAuralAttr cssAttr
595hi def link cssRenderAttr cssAttr
596hi def link cssCascadeAttr cssAttr
597hi def link cssCommonAttr cssAttr
598
599hi def link cssPseudoClassId PreProc
600hi def link cssPseudoClassLang Constant
601hi def link cssValueLength Number
602hi def link cssValueInteger Number
603hi def link cssValueNumber Number
604hi def link cssValueAngle Number
605hi def link cssValueTime Number
606hi def link cssValueFrequency Number
607hi def link cssFunction Constant
608hi def link cssURL String
609hi def link cssFunctionName Function
610hi def link cssFunctionComma Function
611hi def link cssColor Constant
612hi def link cssIdentifier Function
613hi def link cssAtRule Include
614hi def link cssAtKeyword PreProc
615hi def link cssImportant Special
616hi def link cssCustomProp Special
617hi def link cssBraces Function
618hi def link cssBraceError Error
619hi def link cssError Error
620hi def link cssUnicodeEscape Special
621hi def link cssStringQQ String
622hi def link cssStringQ String
623hi def link cssAttributeSelector String
624hi def link cssMediaType Special
625hi def link cssMediaComma Normal
626hi def link cssAtRuleLogical Statement
627hi def link cssMediaProp cssProp
628hi def link cssMediaAttr cssAttr
629hi def link cssPagePseudo PreProc
630hi def link cssPageMarginProp cssAtKeyword
631hi def link cssPageProp cssProp
632hi def link cssKeyFrameProp Constant
633hi def link cssFontDescriptor Special
634hi def link cssFontDescriptorProp cssProp
635hi def link cssFontDescriptorAttr cssAttr
636hi def link cssUnicodeRange Constant
637hi def link cssClassName Function
638hi def link cssClassNameDot Function
639hi def link cssProp StorageClass
640hi def link cssAttr Constant
641hi def link cssUnitDecorators Number
642hi def link cssNoise Noise
643
644let b:current_syntax = "css"
645
646if main_syntax == 'css'
647  unlet main_syntax
648endif
649
650let &cpo = s:cpo_save
651unlet s:cpo_save
652" vim: ts=8
653
654