css.vim 31 KB

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