vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

css.vim (35441B)


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