" 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: 2013 Nov.27 " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded if !exists("main_syntax") if version < 600 syntax clear elseif 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 " All HTML4 tags syn keyword cssTagName abbr acronym address applet area a b base syn keyword cssTagName basefont bdo big blockquote body br button syn keyword cssTagName caption center cite code col colgroup dd del syn keyword cssTagName dfn dir div dl dt em fieldset font form frame syn keyword cssTagName frameset h1 h2 h3 h4 h5 h6 head hr html img i syn keyword cssTagName iframe img input ins isindex kbd label legend li syn keyword cssTagName link map menu meta noframes noscript ol optgroup syn keyword cssTagName option p param pre q s samp script select small syn keyword cssTagName span strike strong style sub sup table tbody td syn keyword cssTagName textarea tfoot th thead title tr tt ul u var syn keyword cssTagName object svg " 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 syn keyword cssDeprecated acronym applet basefont big center dir syn keyword cssDeprecated 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 /\(\(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,cssFontProp,cssFontAttr,cssCommonAttr,cssStringQ,cssStringQQ,cssFontDescriptorProp,cssValue.*,cssFontDescriptorFunction,cssUnicodeRange,cssFontDescriptorAttr "syn match cssFontDescriptorProp contained "\<\(unicode-range\|unit-per-em\|panose-1\|cap-height\|x-height\|definition-src\)\>" "syn keyword cssFontDescriptorProp contained src stemv stemh slope ascent descent widths bbox baseline centerline mathline topline syn keyword cssFontDescriptorProp contained src syn match cssFontDescriptorProp contained "\" syn keyword cssFontDescriptorAttr contained all syn region cssFontDescriptorFunction contained matchgroup=cssFunctionName start="\<\(uri\|url\|local\|format\)\s*(" end=")" contains=cssStringQ,cssStringQQ oneline keepend syn match cssUnicodeRange contained "U+[0-9A-Fa-f?]\+" syn match cssUnicodeRange contained "U+\x\+-\x\+" " 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 /dark\(blue\|cyan\|goldenrod\|gray\|green\|grey\|khaki\)/ syn match cssColor contained /dark\(magenta\|olivegreen\|orange\|orchid\|red\|salmon\|seagreen\)/ syn match cssColor contained /darkslate\(blue\|gray\|grey\)/ syn match cssColor contained /dark\(turquoise\|violet\)/ 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 /light\(blue\|coral\|cyan\|goldenrodyellow\|gray\|green\)/ syn match cssColor contained /light\(grey\|pink\|salmon\|seagreen\|skyblue\|yellow\)/ syn match cssColor contained /light\(slategray\|slategrey\|steelblue\)/ syn match cssColor contained /medium\(aquamarine\|blue\|orchid\|purple\|seagreen\)/ syn match cssColor contained /medium\(slateblue\|springgreen\|turquoise\|violetred\)/ syn keyword cssColor contained midnightblue mintcream mistyrose moccasin navajowhite syn keyword cssColor contained oldlace olivedrab orange orangered orchid syn match cssColor contained /pale\(goldenrod\|green\|turquoise\|violetred\)/ 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 "#[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="\