Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 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 | " Maintainer: Jules Wang <w.jq0722@gmail.com> |
Bram Moolenaar | 3a0d809 | 2012-10-21 03:02:54 +0200 | [diff] [blame] | 8 | " URL: https://github.com/JulesWang/css.vim |
| 9 | " Last Change: 2012 Dec 15 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 10 | |
| 11 | " For version 5.x: Clear all syntax items |
| 12 | " For version 6.x: Quit when a syntax file was already loaded |
| 13 | if !exists("main_syntax") |
| 14 | if version < 600 |
| 15 | syntax clear |
| 16 | elseif exists("b:current_syntax") |
| 17 | finish |
| 18 | endif |
| 19 | let main_syntax = 'css' |
| 20 | endif |
| 21 | |
Bram Moolenaar | 0c5fa7d | 2012-10-05 22:26:30 +0200 | [diff] [blame] | 22 | let s:cpo_save = &cpo |
| 23 | set cpo&vim |
| 24 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 25 | syn case ignore |
| 26 | |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 27 | " All HTML4 tags |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 28 | syn keyword cssTagName abbr acronym address applet area a b base |
| 29 | syn keyword cssTagName basefont bdo big blockquote body br button |
| 30 | syn keyword cssTagName caption center cite code col colgroup dd del |
| 31 | syn keyword cssTagName dfn dir div dl dt em fieldset font form frame |
| 32 | syn keyword cssTagName frameset h1 h2 h3 h4 h5 h6 head hr html img i |
| 33 | syn keyword cssTagName iframe img input ins isindex kbd label legend li |
| 34 | syn keyword cssTagName link map menu meta noframes noscript ol optgroup |
| 35 | syn keyword cssTagName option p param pre q s samp script select small |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 36 | syn keyword cssTagName span strike strong style sub sup table tbody td |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 37 | syn keyword cssTagName textarea tfoot th thead title tr tt ul u var |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 38 | syn keyword cssTagName object |
| 39 | |
| 40 | " HTML5 new tags 5*6=30 |
| 41 | syn keyword cssTagName article aside audio bdi canvas command |
| 42 | syn keyword cssTagName datalist details embed figcaption figure footer |
| 43 | syn keyword cssTagName header hgroup keygen mark meter nav |
| 44 | syn keyword cssTagName output progress rt rp ruby section |
| 45 | syn keyword cssTagName source summary time track video wbr |
| 46 | |
| 47 | " Tags not supported in HTML5 |
| 48 | syn keyword cssDeprecated acronym applet basefont big center dir |
| 49 | syn keyword cssDeprecated font frame frameset noframes strike tt |
| 50 | |
| 51 | "syn match cssTagName "\<table\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 52 | syn match cssTagName "\*" |
| 53 | |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 54 | " selectors |
| 55 | syn match cssSelectorOp "[,>+]" |
| 56 | syn match cssSelectorOp2 "[~|^$*]\?=" contained |
| 57 | " FIXME: add HTML5 attribute |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 58 | syn region cssAttributeSelector matchgroup=cssSelectorOp start="\[" end="]" transparent contains=cssUnicodeEscape,cssSelectorOp2,cssStringQ,cssStringQQ |
| 59 | |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 60 | " .class and #id |
| 61 | syn match cssClassName "\.[A-Za-z][A-Za-z0-9_-]\+" |
| 62 | |
Bram Moolenaar | a5792f5 | 2005-11-23 21:25:05 +0000 | [diff] [blame] | 63 | try |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 64 | syn match cssIdentifier "#[A-Za-zÀ-ÿ_@][A-Za-zÀ-ÿ0-9_@-]*" |
Bram Moolenaar | a5792f5 | 2005-11-23 21:25:05 +0000 | [diff] [blame] | 65 | catch /^.*/ |
| 66 | syn match cssIdentifier "#[A-Za-z_@][A-Za-z0-9_@-]*" |
| 67 | endtry |
| 68 | |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 69 | syn match cssTagName "@page\>" nextgroup=cssDefinition |
| 70 | " FIXME: use cssVendor here |
| 71 | syn match cssTagName "@\(-\(webkit\|moz\|o\|ms\)-\)\=keyframes\>" nextgroup=cssDefinition |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 72 | |
| 73 | syn match cssMedia "@media\>" nextgroup=cssMediaType skipwhite skipnl |
| 74 | syn keyword cssMediaType contained screen print aural braile embosed handheld projection ty tv all nextgroup=cssMediaComma,cssMediaBlock skipwhite skipnl |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 75 | "syn match cssMediaComma "," nextgroup=cssMediaType skipwhite skipnl |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 76 | syn region cssMediaBlock transparent matchgroup=cssBraces start='{' end='}' contains=cssTagName,cssError,cssComment,cssDefinition,cssURL,cssUnicodeEscape,cssIdentifier |
| 77 | |
| 78 | syn match cssValueInteger contained "[-+]\=\d\+" |
| 79 | syn match cssValueNumber contained "[-+]\=\d\+\(\.\d*\)\=" |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 80 | syn match cssValueLength contained "[-+]\=\d\+\(\.\d*\)\=\(%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|rem\)" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 81 | syn match cssValueAngle contained "[-+]\=\d\+\(\.\d*\)\=\(deg\|grad\|rad\)" |
| 82 | syn match cssValueTime contained "+\=\d\+\(\.\d*\)\=\(ms\|s\)" |
| 83 | syn match cssValueFrequency contained "+\=\d\+\(\.\d*\)\=\(Hz\|kHz\)" |
| 84 | |
| 85 | syn match cssFontDescriptor "@font-face\>" nextgroup=cssFontDescriptorBlock skipwhite skipnl |
| 86 | syn region cssFontDescriptorBlock contained transparent matchgroup=cssBraces start="{" end="}" contains=cssComment,cssError,cssUnicodeEscape,cssFontProp,cssFontAttr,cssCommonAttr,cssStringQ,cssStringQQ,cssFontDescriptorProp,cssValue.*,cssFontDescriptorFunction,cssUnicodeRange,cssFontDescriptorAttr |
| 87 | syn match cssFontDescriptorProp contained "\<\(unicode-range\|unit-per-em\|panose-1\|cap-height\|x-height\|definition-src\)\>" |
| 88 | syn keyword cssFontDescriptorProp contained src stemv stemh slope ascent descent widths bbox baseline centerline mathline topline |
| 89 | syn keyword cssFontDescriptorAttr contained all |
| 90 | syn region cssFontDescriptorFunction contained matchgroup=cssFunctionName start="\<\(uri\|url\|local\|format\)\s*(" end=")" contains=cssStringQ,cssStringQQ oneline keepend |
| 91 | syn match cssUnicodeRange contained "U+[0-9A-Fa-f?]\+" |
| 92 | syn match cssUnicodeRange contained "U+\x\+-\x\+" |
| 93 | |
Bram Moolenaar | 3a0d809 | 2012-10-21 03:02:54 +0200 | [diff] [blame] | 94 | " The 16 basic color names |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 95 | syn keyword cssColor contained aqua black blue fuchsia gray green lime maroon navy olive purple red silver teal yellow |
Bram Moolenaar | 3a0d809 | 2012-10-21 03:02:54 +0200 | [diff] [blame] | 96 | |
| 97 | " 130 more color names |
| 98 | syn keyword cssColor contained aliceblue antiquewhite aquamarine azure |
| 99 | syn keyword cssColor contained beige bisque blanchedalmond blueviolet brown burlywood |
| 100 | syn keyword cssColor contained cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan |
| 101 | syn match cssColor contained /dark\(blue\|cyan\|goldenrod\|gray\|green\|grey\|khaki\)/ |
| 102 | syn match cssColor contained /dark\(magenta\|olivegreen\|orange\|orchid\|red\|salmon\|seagreen\)/ |
| 103 | syn match cssColor contained /darkslate\(blue\|gray\|grey\)/ |
| 104 | syn match cssColor contained /dark\(turquoise\|violet\)/ |
| 105 | syn keyword cssColor contained deeppink deepskyblue dimgray dimgrey dodgerblue firebrick |
| 106 | syn keyword cssColor contained floralwhite forestgreen gainsboro ghostwhite gold |
| 107 | syn keyword cssColor contained goldenrod greenyellow grey honeydew hotpink |
| 108 | syn keyword cssColor contained indianred indigo ivory khaki lavender lavenderblush lawngreen |
| 109 | syn keyword cssColor contained lemonchiffon limegreen linen magenta |
| 110 | syn match cssColor contained /light\(blue\|coral\|cyan\|goldenrodyellow\|gray\|green\)/ |
| 111 | syn match cssColor contained /light\(grey\|pink\|salmon\|seagreen\|skyblue\|yellow\)/ |
| 112 | syn match cssColor contained /light\(slategray\|slategrey\|steelblue\)/ |
| 113 | syn match cssColor contained /medium\(aquamarine\|blue\|orchid\|purple\|seagreen\)/ |
| 114 | syn match cssColor contained /medium\(slateblue\|springgreen\|turquoise\|violetred\)/ |
| 115 | syn keyword cssColor contained midnightblue mintcream mistyrose moccasin navajowhite |
| 116 | syn keyword cssColor contained oldlace olivedrab orange orangered orchid |
| 117 | syn match cssColor contained /pale\(goldenrod\|green\|turquoise\|violetred\)/ |
| 118 | syn keyword cssColor contained papayawhip peachpuff peru pink plum powderblue |
| 119 | syn keyword cssColor contained rosybrown royalblue saddlebrown salmon sandybrown |
| 120 | syn keyword cssColor contained seagreen seashell sienna skyblue slateblue |
| 121 | syn keyword cssColor contained slategray slategrey snow springgreen steelblue tan |
| 122 | syn keyword cssColor contained thistle tomato turquoise violet wheat |
| 123 | syn keyword cssColor contained whitesmoke yellowgreen |
| 124 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 125 | " FIXME: These are actually case-insentivie too, but (a) specs recommend using |
| 126 | " mixed-case (b) it's hard to highlight the word `Background' correctly in |
| 127 | " all situations |
| 128 | syn case match |
| 129 | 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 |
| 130 | syn case ignore |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 131 | |
| 132 | syn match cssImportant contained "!\s*important\>" |
| 133 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 134 | syn match cssColor contained "\<transparent\>" |
| 135 | syn match cssColor contained "\<white\>" |
| 136 | syn match cssColor contained "#[0-9A-Fa-f]\{3\}\>" |
| 137 | syn match cssColor contained "#[0-9A-Fa-f]\{6\}\>" |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 138 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 139 | syn region cssURL contained matchgroup=cssFunctionName start="\<url\s*(" end=")" oneline keepend |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 140 | syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgb\|clip\|attr\|counter\|rect\|cubic-bezier\)\s*(" end=")" oneline keepend |
| 141 | syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgba\|hsl\|hsla\)\s*(" end=")" oneline keepend |
| 142 | syn region cssFunction contained matchgroup=cssFunctionName start="\<\(linear\|radial\)-gradient\s*(" end=")" oneline keepend |
| 143 | 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 keepend |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 144 | |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 145 | " Prop and Attr |
| 146 | " Reference: http://www.w3schools.com/cssref/default.asp |
| 147 | syn keyword cssCommonAttr contained auto none inherit all |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 148 | syn keyword cssCommonAttr contained top bottom |
| 149 | syn keyword cssCommonAttr contained medium normal |
| 150 | |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 151 | |
| 152 | syn match cssAnimationProp contained "\<animation\(-\(name\|duration\|timing-function\|delay\|iteration-cout\|play-state\)\)\=\>" |
| 153 | |
| 154 | |
| 155 | syn keyword cssAnimationAttr contained infinite alternate paused running |
| 156 | " bugfix: escape linear-gradient |
| 157 | syn match cssAnimationAttr contained "\<linear\(-gradient\)\@!\>" |
| 158 | syn match cssAnimationAttr contained "\<ease\(-\(in-out\|out\|in\)\)\=\>" |
| 159 | |
| 160 | syn match cssBackgroundProp contained "\<background\(-\(color\|image\|attachment\|position\|clip\|origin\|size\)\)\=\>" |
| 161 | syn keyword cssBackgroundAttr contained center fixed over contain |
| 162 | syn match cssBackgroundAttr contained "\<no-repeat\>" |
| 163 | syn match cssBackgroundAttr contained "\<repeat\(-[xy]\)\=\>" |
| 164 | syn match cssBackgroundAttr contained "\<\(border\|content\|padding\)-box\>" |
| 165 | |
| 166 | |
| 167 | syn match cssBorderOutlineProp contained "\<border\(-\(top\|right\|bottom\|left\)\)\=\(-\(width\|color\|style\)\)\=\>" |
| 168 | syn match cssBorderOutlineProp contained "\<outline\(-\(width\|style\|color\)\)\=\>" |
| 169 | syn match cssBorderOutlineProp contained "\<border-\(top\|bottom\)-\(left\|right\)\(-radius\)\=\>" |
| 170 | syn match cssBorderOutlineProp contained "\<border-image\(-\(outset\|repeat\|slice\|source\|width\)\)\=\>" |
| 171 | syn match cssBorderOutlineProp contained "\<border-radius\>" |
| 172 | syn keyword cssBorderOutlineAttr contained thin thick medium |
| 173 | syn keyword cssBorderOutlineAttr contained dotted dashed solid double groove ridge inset outset |
| 174 | syn keyword cssBorderOutlineAttr contained hidden visible scroll collapse |
| 175 | syn keyword cssBorderOutlineAttr contained stretch round |
| 176 | |
| 177 | |
| 178 | syn match cssBoxProp contained "\<overflow\(-\(x\|y\|style\)\)\=\>" |
| 179 | syn match cssBoxProp contained "\<rotation\(-point\)=\>" |
| 180 | syn keyword cssBoxAttr contained visible hidden scroll auto |
| 181 | syn match cssBoxAttr contained "\<no-\(display\|content\)\>" |
| 182 | |
| 183 | syn keyword cssColorProp contained opacity |
| 184 | syn match cssColorProp contained "\<color-profile\>" |
| 185 | syn match cssColorProp contained "\<rendering-intent\>" |
| 186 | |
| 187 | |
| 188 | syn match cssDimensionProp contained "\<\(min\|max\)-\(width\|height\)\>" |
| 189 | syn keyword cssDimensionProp contained height |
| 190 | syn keyword cssDimensionProp contained width |
| 191 | |
| 192 | " shadow and sizing are in other property groups |
| 193 | syn match cssFlexibleBoxProp contained "\<box-\(align\|direction\|flex\|ordinal-group\|orient\|pack\|shadow\|sizing\)\>" |
| 194 | syn keyword cssFlexibleBoxAttr contained start end center baseline stretch |
| 195 | syn keyword cssFlexibleBoxAttr contained normal reverse |
| 196 | syn keyword cssFlexibleBoxAttr contained single mulitple |
| 197 | syn keyword cssFlexibleBoxAttr contained horizontal |
| 198 | " bugfix: escape vertial-align |
| 199 | syn match cssFlexibleBoxAttr contained "\<vertical\(-align\)\@!\>" |
| 200 | syn match cssFlexibleBoxAttr contained "\<\(inline\|block\)-axis\>" |
| 201 | |
| 202 | |
Bram Moolenaar | 59c0395 | 2010-07-28 12:52:27 +0200 | [diff] [blame] | 203 | syn match cssFontProp contained "\<font\(-\(family\|style\|variant\|weight\|size\(-adjust\)\=\|stretch\)\)\=\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 204 | syn match cssFontAttr contained "\<\(sans-\)\=\<serif\>" |
Bram Moolenaar | 59c0395 | 2010-07-28 12:52:27 +0200 | [diff] [blame] | 205 | syn match cssFontAttr contained "\<small\(-\(caps\|caption\)\)\=\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 206 | syn match cssFontAttr contained "\<x\{1,2\}-\(large\|small\)\>" |
| 207 | syn match cssFontAttr contained "\<message-box\>" |
| 208 | syn match cssFontAttr contained "\<status-bar\>" |
| 209 | syn match cssFontAttr contained "\<\(\(ultra\|extra\|semi\|status-bar\)-\)\=\(condensed\|expanded\)\>" |
| 210 | syn keyword cssFontAttr contained cursive fantasy monospace italic oblique |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 211 | syn keyword cssFontAttr contained bold bolder light lighter larger smaller |
| 212 | syn keyword cssFontAttr contained icon menu caption |
| 213 | syn keyword cssFontAttr contained large smaller larger narrower wider |
| 214 | syn keyword cssFontAttr contained Courier Arial Georgia Times |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 215 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 216 | |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 217 | syn keyword cssGeneratedContentProp contained content quotes crop |
| 218 | syn match cssGeneratedContentProp contained "\<counter-\(reset\|increment\)\>" |
| 219 | syn match cssGeneratedContentProp contained "\<move-to\>" |
| 220 | syn match cssGeneratedContentProp contained "\<page-policy\>" |
| 221 | syn match cssGeneratedContentAttr contained "\<\(no-\)\=\(open\|close\)-quote\>" |
| 222 | |
| 223 | |
| 224 | syn match cssGridProp contained "\<grid-\(columns\|rows\)\>" |
| 225 | |
| 226 | syn match cssHyerlinkProp contained "\<target\(-\(name\|new\|position\)\)\=\>" |
| 227 | |
| 228 | syn match cssListProp contained "\<list-style\(-\(type\|position\|image\)\)\=\>" |
| 229 | syn match cssListAttr contained "\<\(lower\|upper\)-\(roman\|alpha\|greek\|latin\)\>" |
| 230 | syn match cssListAttr contained "\<\(hiragana\|katakana\)\(-iroha\)\=\>" |
| 231 | syn match cssListAttr contained "\<\(decimal\(-leading-zero\)\=\|cjk-ideographic\)\>" |
| 232 | syn keyword cssListAttr contained disc circle square hebrew armenian georgian |
| 233 | syn keyword cssListAttr contained inside outside |
| 234 | |
| 235 | |
| 236 | syn match cssMarginProp contained "\<margin\(-\(top\|right\|bottom\|left\)\)\=\>" |
| 237 | |
| 238 | syn match cssMultiColumnProp contained "\<column\(-\(\break-\(after\|before\)\|count\|gap\|rule\(-\(color\|style\|width\)\)\=\)\|span\|width\)\=\>" |
| 239 | |
| 240 | |
| 241 | syn match cssPaddingProp contained "\<padding\(-\(top\|right\|bottom\|left\)\)\=\>" |
| 242 | |
| 243 | syn keyword cssPositioningProp contained bottom clear clip display float left |
| 244 | syn keyword cssPositioningProp contained position right top visibility |
| 245 | syn match cssPositioningProp contained "\<z-index\>" |
| 246 | syn keyword cssPositioningAttr contained block inline compact |
| 247 | syn match cssPositioningAttr contained "\<table\(-\(row-gorup\|\(header\|footer\)-group\|row\|column\(-group\)\=\|cell\|caption\)\)\=\>" |
| 248 | syn keyword cssPositioningAttr contained left right both |
| 249 | syn match cssPositioningAttr contained "\<list-item\>" |
| 250 | syn match cssPositioningAttr contained "\<inline-\(block\|table\)\>" |
| 251 | syn keyword cssPositioningAttr contained static relative absolute fixed |
| 252 | |
| 253 | syn match cssPrintProp contained "\<page\(-break-\(before\|after\|inside\)\)\=\>" |
| 254 | syn keyword cssPrintProp contained orphans widows |
| 255 | syn keyword cssPrintAttr contained landscape portrait crop cross always avoid |
| 256 | |
| 257 | syn match cssTableProp contained "\<\(caption-side\|table-layout\|border-collapse\|border-spacing\|empty-cells\)\>" |
| 258 | syn keyword cssTableAttr contained fixed collapse separate show hide once always |
| 259 | |
| 260 | |
| 261 | syn keyword cssTextProp contained color direction |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 262 | syn match cssTextProp "\<\(\(word\|letter\)-spacing\|text\(-\(decoration\|transform\|align\|index\|shadow\)\)\=\|vertical-align\|unicode-bidi\|line-height\)\>" |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 263 | syn match cssTextProp contained "\<text-\(justify\|\outline\|overflow\|warp\|align-last\)\>" |
| 264 | syn match cssTextProp contained "\<word-\(break\|\wrap\)\>" |
| 265 | syn match cssTextProp contained "\<white-space\>" |
| 266 | syn match cssTextProp contained "\<hanging-punctuation\>" |
| 267 | syn match cssTextProp contained "\<punctuation-trim\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 268 | syn match cssTextAttr contained "\<line-through\>" |
| 269 | syn match cssTextAttr contained "\<text-indent\>" |
| 270 | syn match cssTextAttr contained "\<\(text-\)\=\(top\|bottom\)\>" |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 271 | syn keyword cssTextAttr contained ltr rtl embed nowrap |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 272 | syn keyword cssTextAttr contained underline overline blink sub super middle |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 273 | syn keyword cssTextAttr contained capitalize uppercase lowercase |
| 274 | syn keyword cssTextAttr contained center justify baseline sub super |
| 275 | syn match cssTextAttr contained "\<pre\(-\(line\|wrap\)\)\=\>" |
| 276 | syn match cssTextAttr contained "\<\(allow\|force\)-end\>" |
| 277 | syn keyword cssTextAttr contained start end adjacent |
| 278 | syn match cssTextAttr contained "\<inter-\(word\|ideographic\|cluster\)\>" |
| 279 | syn keyword cssTextAttr contained distribute kashida first last |
| 280 | syn keyword cssTextAttr contained clip ellipsis unrestricted suppress |
| 281 | syn match cssTextAttr contained "\<break-all\>" |
| 282 | syn match cssTextAttr contained "\<break-word\>" |
| 283 | syn keyword cssTextAttr contained hyphenate |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 284 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 285 | |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 286 | syn match cssTransformProp contained "\<transform\(-\(origin\|style\)\)\=\>" |
| 287 | syn match cssTransformProp contained "\<perspective\(-origin\)\=\>" |
| 288 | syn match cssTransformProp contained "\<backface-visibility\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 289 | |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 290 | syn match cssTransitionProp contained "\<transition\(-\(delay\|duration\|property\|timing-function\)\)\=\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 291 | |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 292 | syn match cssUIProp contained "\<nav-\(down\|index\|left\|right\|up\)\=\>" |
| 293 | syn match cssUIProp contained "\<outline-offset\>" |
| 294 | syn match cssUIProp contained "\<box-sizing\>" |
| 295 | syn keyword cssUIProp contained appearance icon resize |
| 296 | syn keyword cssUIAttr contained window button menu field |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 297 | |
| 298 | syn match cssAuralProp contained "\<\(pause\|cue\)\(-\(before\|after\)\)\=\>" |
| 299 | syn match cssAuralProp contained "\<\(play-during\|speech-rate\|voice-family\|pitch\(-range\)\=\|speak\(-\(punctuation\|numerals\)\)\=\)\>" |
| 300 | syn keyword cssAuralProp contained volume during azimuth elevation stress richness |
| 301 | syn match cssAuralAttr contained "\<\(x-\)\=\(soft\|loud\)\>" |
| 302 | syn keyword cssAuralAttr contained silent |
| 303 | syn match cssAuralAttr contained "\<spell-out\>" |
| 304 | syn keyword cssAuralAttr contained non mix |
| 305 | syn match cssAuralAttr contained "\<\(left\|right\)-side\>" |
| 306 | syn match cssAuralAttr contained "\<\(far\|center\)-\(left\|center\|right\)\>" |
| 307 | syn keyword cssAuralAttr contained leftwards rightwards behind |
| 308 | syn keyword cssAuralAttr contained below level above higher |
| 309 | syn match cssAuralAttr contained "\<\(x-\)\=\(slow\|fast\)\>" |
| 310 | syn keyword cssAuralAttr contained faster slower |
| 311 | syn keyword cssAuralAttr contained male female child code digits continuous |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 312 | syn match cssAuralAttr contained "\<lower\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 313 | |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 314 | " cursor |
| 315 | syn keyword cssUIProp contained cursor |
| 316 | syn match cssUIAttr contained "\<[ns]\=[ew]\=-resize\>" |
| 317 | syn keyword cssUIAttr contained crosshair default help move pointer |
| 318 | syn keyword cssUIAttr contained progress wait |
| 319 | |
| 320 | " FIXME: I could not find them in reference |
| 321 | syn keyword cssUIAttr contained invert maker size zoom |
| 322 | syn match cssRenderAttr contained "\<run-in\>" |
| 323 | syn match cssRenderAttr contained "\<text-rendering\>" |
| 324 | syn match cssRenderAttr contained "\<font-smoothing\>" |
| 325 | syn match cssRenderProp contained "\<marker-offset\>" |
| 326 | syn match cssRenderAttr contained "\<bidi-override\>" |
| 327 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 328 | |
| 329 | " FIXME: This allows cssMediaBlock before the semicolon, which is wrong. |
| 330 | syn region cssInclude start="@import" end=";" contains=cssComment,cssURL,cssUnicodeEscape,cssMediaType |
| 331 | syn match cssBraces contained "[{}]" |
| 332 | syn match cssError contained "{@<>" |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 333 | syn region cssDefinition transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 334 | syn match cssBraceError "}" |
| 335 | |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 336 | " Pseudo class |
Bram Moolenaar | f1568ec | 2011-12-14 21:17:39 +0100 | [diff] [blame] | 337 | syn match cssPseudoClass ":[A-Za-z0-9_-]*" contains=cssPseudoClassId,cssUnicodeEscape |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 338 | syn keyword cssPseudoClassId link visited active hover focus before after left right lang |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 339 | syn match cssPseudoClassId contained "\<first\(-\(line\|letter\|child\)\)\=\>" |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 340 | " FIXME: handle functions. |
| 341 | "syn region cssPseudoClassLang matchgroup=cssPseudoClassId start="lang(" end=")" |
| 342 | syn match cssPseudoClassId contained "\<\(last\|only\|nth\|nth-last\)-child\>" |
| 343 | syn match cssPseudoClassId contained "\<\(first\|last\|only\|nth\|nth-last\)-of-type\>" |
| 344 | syn keyword cssPseudoClassId root empty target enable disabled checked not invalid |
| 345 | syn match cssPseudoClassId contained "::\(-moz-\)\=selection" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 346 | |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 347 | " Comment |
Bram Moolenaar | 29c3472 | 2007-05-12 15:34:06 +0000 | [diff] [blame] | 348 | syn region cssComment start="/\*" end="\*/" contains=@Spell |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 349 | syn region cssComment start="//" skip="\\$" end="$" keepend contains=@Spell |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 350 | |
| 351 | syn match cssUnicodeEscape "\\\x\{1,6}\s\?" |
| 352 | syn match cssSpecialCharQQ +\\"+ contained |
| 353 | syn match cssSpecialCharQ +\\'+ contained |
| 354 | syn region cssStringQQ start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=cssUnicodeEscape,cssSpecialCharQQ |
| 355 | syn region cssStringQ start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=cssUnicodeEscape,cssSpecialCharQ |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 356 | |
| 357 | " Vendor Prefix |
| 358 | syn match cssVendor contained "\(-\(webkit\|moz\|o\|ms\)-\)" |
| 359 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 360 | |
| 361 | if main_syntax == "css" |
| 362 | syn sync minlines=10 |
| 363 | endif |
| 364 | |
| 365 | " Define the default highlighting. |
| 366 | " For version 5.7 and earlier: only when not done already |
| 367 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 368 | if version >= 508 || !exists("did_css_syn_inits") |
| 369 | if version < 508 |
| 370 | let did_css_syn_inits = 1 |
| 371 | command -nargs=+ HiLink hi link <args> |
| 372 | else |
| 373 | command -nargs=+ HiLink hi def link <args> |
| 374 | endif |
| 375 | |
| 376 | HiLink cssComment Comment |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 377 | HiLink cssVendor Comment |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 378 | HiLink cssTagName Statement |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 379 | HiLink cssDeprecated Error |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 380 | HiLink cssSelectorOp Special |
| 381 | HiLink cssSelectorOp2 Special |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 382 | |
| 383 | HiLink cssAnimationProp StorageClass |
| 384 | HiLink cssBackgroundProp StorageClass |
| 385 | HiLink cssBorderOutlineProp StorageClass |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 386 | HiLink cssBoxProp StorageClass |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 387 | HiLink cssColorProp StorageClass |
| 388 | HiLink cssContentForPagedMediaProp StorageClass |
| 389 | HiLink cssDimensionProp StorageClass |
| 390 | HiLink cssFlexibleBoxProp StorageClass |
| 391 | HiLink cssFontProp StorageClass |
| 392 | HiLink cssGeneratedContentProp StorageClass |
| 393 | HiLink cssGridProp StorageClass |
| 394 | HiLink cssHyerlinkProp StorageClass |
| 395 | HiLink cssLineboxProp StorageClass |
| 396 | HiLink cssListProp StorageClass |
| 397 | HiLink cssMarginProp StorageClass |
| 398 | HiLink cssMarqueeProp StorageClass |
| 399 | HiLink cssMultiColumnProp StorageClass |
| 400 | HiLink cssPaddingProp StorageClass |
| 401 | HiLink cssPagedMediaProp StorageClass |
| 402 | HiLink cssPositioningProp StorageClass |
| 403 | HiLink cssPrintProp StorageClass |
| 404 | HiLink cssRubyProp StorageClass |
| 405 | HiLink cssSpeechProp StorageClass |
| 406 | HiLink cssTableProp StorageClass |
| 407 | HiLink cssTextProp StorageClass |
| 408 | HiLink cssTransformProp StorageClass |
| 409 | HiLink cssTransitionProp StorageClass |
| 410 | HiLink cssUIProp StorageClass |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 411 | HiLink cssAuralProp StorageClass |
| 412 | HiLink cssRenderProp StorageClass |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 413 | |
| 414 | HiLink cssAnimationAttr Type |
| 415 | HiLink cssBackgroundAttr Type |
| 416 | HiLink cssBorderOutlineAttr Type |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 417 | HiLink cssBoxAttr Type |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 418 | HiLink cssColorAttr Type |
| 419 | HiLink cssContentForPagedMediaAttr Type |
| 420 | HiLink cssDimensionAttr Type |
| 421 | HiLink cssFlexibleBoxAttr Type |
| 422 | HiLink cssFontAttr Type |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 423 | HiLink cssGeneratedContentAttr Type |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 424 | HiLink cssGridAttr Type |
| 425 | HiLink cssHyerlinkAttr Type |
| 426 | HiLink cssLineboxAttr Type |
| 427 | HiLink cssListAttr Type |
| 428 | HiLink cssMarginAttr Type |
| 429 | HiLink cssMarqueeAttr Type |
| 430 | HiLink cssMultiColumnAttr Type |
| 431 | HiLink cssPaddingAttr Type |
| 432 | HiLink cssPagedMediaAttr Type |
| 433 | HiLink cssPositioningAttr Type |
| 434 | HiLink cssPrintAttr Type |
| 435 | HiLink cssRubyAttr Type |
| 436 | HiLink cssSpeechAttr Type |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 437 | HiLink cssTableAttr Type |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 438 | HiLink cssTextAttr Type |
| 439 | HiLink cssTransformAttr Type |
| 440 | HiLink cssTransitionAttr Type |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 441 | HiLink cssUIAttr Type |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 442 | HiLink cssAuralAttr Type |
| 443 | HiLink cssRenderAttr Type |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 444 | HiLink cssCommonAttr Type |
Bram Moolenaar | d09acef | 2012-09-21 14:54:30 +0200 | [diff] [blame] | 445 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 446 | HiLink cssPseudoClassId PreProc |
| 447 | HiLink cssPseudoClassLang Constant |
| 448 | HiLink cssValueLength Number |
| 449 | HiLink cssValueInteger Number |
| 450 | HiLink cssValueNumber Number |
| 451 | HiLink cssValueAngle Number |
| 452 | HiLink cssValueTime Number |
| 453 | HiLink cssValueFrequency Number |
| 454 | HiLink cssFunction Constant |
| 455 | HiLink cssURL String |
| 456 | HiLink cssFunctionName Function |
| 457 | HiLink cssColor Constant |
| 458 | HiLink cssIdentifier Function |
| 459 | HiLink cssInclude Include |
| 460 | HiLink cssImportant Special |
| 461 | HiLink cssBraces Function |
| 462 | HiLink cssBraceError Error |
| 463 | HiLink cssError Error |
| 464 | HiLink cssInclude Include |
| 465 | HiLink cssUnicodeEscape Special |
| 466 | HiLink cssStringQQ String |
| 467 | HiLink cssStringQ String |
| 468 | HiLink cssMedia Special |
| 469 | HiLink cssMediaType Special |
| 470 | HiLink cssMediaComma Normal |
| 471 | HiLink cssFontDescriptor Special |
| 472 | HiLink cssFontDescriptorFunction Constant |
| 473 | HiLink cssFontDescriptorProp StorageClass |
| 474 | HiLink cssFontDescriptorAttr Type |
| 475 | HiLink cssUnicodeRange Constant |
Bram Moolenaar | 29c3472 | 2007-05-12 15:34:06 +0000 | [diff] [blame] | 476 | HiLink cssClassName Function |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 477 | delcommand HiLink |
| 478 | endif |
| 479 | |
| 480 | let b:current_syntax = "css" |
| 481 | |
| 482 | if main_syntax == 'css' |
| 483 | unlet main_syntax |
| 484 | endif |
| 485 | |
Bram Moolenaar | 0c5fa7d | 2012-10-05 22:26:30 +0200 | [diff] [blame] | 486 | let &cpo = s:cpo_save |
| 487 | unlet s:cpo_save |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 488 | " vim: ts=8 |
| 489 | |