" Vim syntax file " Language: Cascading Style Sheets " Previous Contributor List: " Claudio Fleiner (Maintainer) " Yeti (Add full CSS2, HTML4 support) " Nikolai Weibull (Add CSS2 support) " Maintainer: Jules Wang " URL: https://github.com/JulesWang/css.vim " Last Change: 2015 Apr.17 " quit when a syntax file was already loaded if !exists("main_syntax") if exists("b:current_syntax") finish endif let main_syntax = 'css' elseif exists("b:current_syntax") && b:current_syntax == "css" finish endif let s:cpo_save = &cpo set cpo&vim syn case ignore " HTML4 tags syn keyword cssTagName abbr address area a b base syn keyword cssTagName bdo blockquote body br button syn keyword cssTagName caption cite code col colgroup dd del syn keyword cssTagName dfn div dl dt em fieldset form syn keyword cssTagName h1 h2 h3 h4 h5 h6 head hr html img i syn keyword cssTagName iframe input ins isindex kbd label legend li syn keyword cssTagName link map menu meta noscript ol optgroup syn keyword cssTagName option p param pre q s samp script small syn keyword cssTagName span strong sub sup tbody td syn keyword cssTagName textarea tfoot th thead title tr ul u var syn keyword cssTagName object svg syn match cssTagName /\\|\\|\/ " 34 HTML5 tags syn keyword cssTagName article aside audio bdi canvas command data syn keyword cssTagName datalist details dialog embed figcaption figure footer syn keyword cssTagName header hgroup keygen main mark menuitem meter nav syn keyword cssTagName output progress rt rp ruby section syn keyword cssTagName source summary time track video wbr " Tags not supported in HTML5 " acronym applet basefont big center dir " font frame frameset noframes strike tt syn match cssTagName "\*" " selectors syn match cssSelectorOp "[,>+~]" syn match cssSelectorOp2 "[~|^$*]\?=" contained syn region cssAttributeSelector matchgroup=cssSelectorOp start="\[" end="]" contains=cssUnicodeEscape,cssSelectorOp2,cssStringQ,cssStringQQ " .class and #id syn match cssClassName "\.[A-Za-z][A-Za-z0-9_-]\+" contains=cssClassNameDot syn match cssClassNameDot contained '\.' try syn match cssIdentifier "#[A-Za-zĄ-’_@][A-Za-zĄ-’0-9_@-]*" catch /^.*/ syn match cssIdentifier "#[A-Za-z_@][A-Za-z0-9_@-]*" endtry " digits syn match cssValueInteger contained "[-+]\=\d\+" contains=cssUnitDecorators syn match cssValueNumber contained "[-+]\=\d\+\(\.\d*\)\=" contains=cssUnitDecorators syn match cssValueLength contained "[-+]\=\d\+\(\.\d*\)\=\(%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|rem\|dpi\|dppx\|dpcm\)\>" contains=cssUnitDecorators syn match cssValueAngle contained "[-+]\=\d\+\(\.\d*\)\=\(deg\|grad\|rad\)\>" contains=cssUnitDecorators syn match cssValueTime contained "+\=\d\+\(\.\d*\)\=\(ms\|s\)\>" contains=cssUnitDecorators syn match cssValueFrequency contained "+\=\d\+\(\.\d*\)\=\(Hz\|kHz\)\>" contains=cssUnitDecorators syn match cssIncludeKeyword /@\(-[a-z]\+-\)\=\(media\|keyframes\|import\|charset\|namespace\|page\)/ contained " @media syn region cssInclude start=/@media\>/ end=/\ze{/ skipwhite skipnl contains=cssMediaProp,cssValueLength,cssMediaKeyword,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType,cssIncludeKeyword,cssMediaComma,cssComment nextgroup=cssMediaBlock syn keyword cssMediaType contained screen print aural braille embossed handheld projection tty tv speech all contained skipwhite skipnl syn keyword cssMediaKeyword only not and contained syn region cssMediaBlock transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssTagName,cssClassName,cssIdentifier,cssPseudoClass,cssSelectorOp,cssSelectorOp2,cssAttributeSelector fold syn match cssMediaComma "," skipwhite skipnl contained " Reference: http://www.w3.org/TR/css3-mediaqueries/ syn keyword cssMediaProp contained width height orientation scan grid syn match cssMediaProp contained /\(\(max\|min\)-\)\=\(\(device\)-\)\=aspect-ratio/ syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-pixel-ratio/ syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-\(height\|width\)/ syn match cssMediaProp contained /\(\(max\|min\)-\)\=\(height\|width\|resolution\|monochrome\|color\(-index\)\=\)/ syn keyword cssMediaAttr contained portrait landscape progressive interlace " @page " http://www.w3.org/TR/css3-page/ syn match cssPage "@page\>[^{]*{\@=" contains=cssPagePseudo,cssIncludeKeyword nextgroup=cssPageWrap transparent skipwhite skipnl syn match cssPagePseudo /:\(left\|right\|first\|blank\)/ contained skipwhite skipnl syn region cssPageWrap contained transparent matchgroup=cssBraces start="{" end="}" contains=cssPageMargin,cssPageProp,cssAttrRegion,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssHacks syn match cssPageMargin /@\(\(top\|left\|right\|bottom\)-\(left\|center\|right\|middle\|bottom\)\)\(-corner\)\=/ contained nextgroup=cssDefinition skipwhite skipnl syn keyword cssPageProp contained content size " http://www.w3.org/TR/CSS2/page.html#break-inside syn keyword cssPageProp contained orphans widows " @keyframe " http://www.w3.org/TR/css3-animations/#keyframes syn match cssKeyFrame "@\(-[a-z]\+-\)\=keyframes\>[^{]*{\@=" nextgroup=cssKeyFrameWrap contains=cssVendor,cssIncludeKeyword skipwhite skipnl transparent syn region cssKeyFrameWrap contained transparent matchgroup=cssBraces start="{" end="}" contains=cssKeyFrameSelector syn match cssKeyFrameSelector /\(\d*%\|from\|to\)\=/ contained skipwhite skipnl nextgroup=cssDefinition " @import syn region cssInclude start=/@import\>/ end=/\ze;/ transparent contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssIncludeKeyword,cssURL,cssMediaProp,cssValueLength,cssMediaKeyword,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType syn region cssInclude start=/@charset\>/ end=/\ze;/ transparent contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssIncludeKeyword syn region cssInclude start=/@namespace\>/ end=/\ze;/ transparent contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssIncludeKeyword " @font-face " http://www.w3.org/TR/css3-fonts/#at-font-face-rule syn match cssFontDescriptor "@font-face\>" nextgroup=cssFontDescriptorBlock skipwhite skipnl syn region cssFontDescriptorBlock contained transparent matchgroup=cssBraces start="{" end="}" contains=cssComment,cssError,cssUnicodeEscape,cssCommonAttr,cssFontDescriptorProp,cssValue.*,cssFontDescriptorFunction,cssFontDescriptorAttr,cssNoise syn match cssFontDescriptorProp contained "\" syn keyword cssFontDescriptorProp contained src syn match cssFontDescriptorProp contained "\" syn match cssFontDescriptorProp contained "\" syn match cssFontDescriptorProp contained "\" " src functions syn region cssFontDescriptorFunction contained matchgroup=cssFunctionName start="\<\(uri\|url\|local\|format\)\s*(" end=")" contains=cssStringQ,cssStringQQ oneline keepend " font-sytle and font-weight attributes syn keyword cssFontDescriptorAttr contained normal italic oblique bold " font-stretch attributes syn match cssFontDescriptorAttr contained "\<\(\(ultra\|extra\|semi\)-\)\=\(condensed\|expanded\)\>" " unicode-range attributes syn match cssFontDescriptorAttr contained "U+[0-9A-Fa-f?]\+" syn match cssFontDescriptorAttr contained "U+\x\+-\x\+" " font-feature-settings attributes syn keyword cssFontDescriptorAttr contained on off " The 16 basic color names syn keyword cssColor contained aqua black blue fuchsia gray green lime maroon navy olive purple red silver teal yellow " 130 more color names syn keyword cssColor contained aliceblue antiquewhite aquamarine azure syn keyword cssColor contained beige bisque blanchedalmond blueviolet brown burlywood syn keyword cssColor contained cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan syn match cssColor contained /\/ syn match cssColor contained /\/ syn match cssColor contained /\/ syn match cssColor contained /\/ syn keyword cssColor contained deeppink deepskyblue dimgray dimgrey dodgerblue firebrick syn keyword cssColor contained floralwhite forestgreen gainsboro ghostwhite gold syn keyword cssColor contained goldenrod greenyellow grey honeydew hotpink syn keyword cssColor contained indianred indigo ivory khaki lavender lavenderblush lawngreen syn keyword cssColor contained lemonchiffon limegreen linen magenta syn match cssColor contained /\/ syn match cssColor contained /\/ syn match cssColor contained /\/ syn match cssColor contained /\/ syn match cssColor contained /\/ syn keyword cssColor contained midnightblue mintcream mistyrose moccasin navajowhite syn keyword cssColor contained oldlace olivedrab orange orangered orchid syn match cssColor contained /\/ syn keyword cssColor contained papayawhip peachpuff peru pink plum powderblue syn keyword cssColor contained rosybrown royalblue saddlebrown salmon sandybrown syn keyword cssColor contained seagreen seashell sienna skyblue slateblue syn keyword cssColor contained slategray slategrey snow springgreen steelblue tan syn keyword cssColor contained thistle tomato turquoise violet wheat syn keyword cssColor contained whitesmoke yellowgreen " FIXME: These are actually case-insensitive too, but (a) specs recommend using " mixed-case (b) it's hard to highlight the word `Background' correctly in " all situations syn case match 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 syn case ignore syn match cssImportant contained "!\s*important\>" syn match cssColor contained "\" syn match cssColor contained "\" syn match cssColor contained "\" syn match cssColor contained "#[0-9A-Fa-f]\{3\}\>" contains=cssUnitDecorators syn match cssColor contained "#[0-9A-Fa-f]\{6\}\>" contains=cssUnitDecorators syn region cssURL contained matchgroup=cssFunctionName start="\