|
|
|
@ -6,8 +6,7 @@
|
|
|
|
|
" Nikolai Weibull (Add CSS2 support)
|
|
|
|
|
" URL: https://github.com/JulesWang/css.vim
|
|
|
|
|
" Maintainer: Jules Wang <w.jq0722@gmail.com>
|
|
|
|
|
" Last Change: 2018 Feb. 27
|
|
|
|
|
" cssClassName updated by Ryuichi Hayashida Jan 2016
|
|
|
|
|
" Last Change: 2019 Jul. 29
|
|
|
|
|
|
|
|
|
|
" quit when a syntax file was already loaded
|
|
|
|
|
if !exists("main_syntax")
|
|
|
|
@ -69,7 +68,7 @@ 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 cssValueLength contained "[-+]\=\d\+\(\.\d*\)\=\(mm\|cm\|in\|pt\|pc\|em\|ex\|px\|rem\|dpi\|dppx\|dpcm\|fr\|vw\|vh\|vmin\|vmax\)\>" contains=cssUnitDecorators
|
|
|
|
|
syn match cssValueLength contained "[-+]\=\d\+\(\.\d*\)\=%" contains=cssUnitDecorators
|
|
|
|
|
syn match cssValueAngle contained "[-+]\=\d\+\(\.\d*\)\=\(deg\|grad\|rad\)\>" contains=cssUnitDecorators
|
|
|
|
|
syn match cssValueTime contained "+\=\d\+\(\.\d*\)\=\(ms\|s\)\>" contains=cssUnitDecorators
|
|
|
|
@ -114,6 +113,7 @@ syn keyword cssColor contained ActiveBorder ActiveCaption AppWorkspace ButtonFac
|
|
|
|
|
syn case ignore
|
|
|
|
|
|
|
|
|
|
syn match cssImportant contained "!\s*important\>"
|
|
|
|
|
syn match cssCustomProp contained "--[a-zA-Z0-9-_]*"
|
|
|
|
|
|
|
|
|
|
syn match cssColor contained "\<transparent\>"
|
|
|
|
|
syn match cssColor contained "\<currentColor\>"
|
|
|
|
@ -123,6 +123,7 @@ syn match cssColor contained "#\x\{6\}\>" contains=cssUnitDecorators
|
|
|
|
|
syn match cssColor contained "#\x\{8\}\>" contains=cssUnitDecorators
|
|
|
|
|
|
|
|
|
|
syn region cssURL contained matchgroup=cssFunctionName start="\<\(uri\|url\|local\|format\)\s*(" end=")" contains=cssStringQ,cssStringQQ oneline
|
|
|
|
|
syn region cssFunction contained matchgroup=cssFunctionName start="\<\(var\|calc\)\s*(" end=")" contains=cssCustomProp,cssValue.*,cssFunction,cssColor,cssStringQ,cssStringQQ oneline
|
|
|
|
|
syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgb\|clip\|attr\|counter\|rect\|cubic-bezier\|steps\)\s*(" end=")" oneline contains=cssValueInteger,cssValueNumber,cssValueLength,cssFunctionComma
|
|
|
|
|
syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgba\|hsl\|hsla\|color-stop\|from\|to\)\s*(" end=")" oneline contains=cssColor,cssValueInteger,cssValueNumber,cssValueLength,cssFunctionComma,cssFunction
|
|
|
|
|
syn region cssFunction contained matchgroup=cssFunctionName start="\<\(linear-\|radial-\)\=\gradient\s*(" end=")" oneline contains=cssColor,cssValueInteger,cssValueNumber,cssValueLength,cssFunction,cssGradientAttr,cssFunctionComma
|
|
|
|
@ -193,6 +194,9 @@ syn match cssBoxProp contained "\<rotation\(-point\)\=\>"
|
|
|
|
|
syn keyword cssBoxAttr contained visible hidden scroll auto
|
|
|
|
|
syn match cssBoxAttr contained "\<no-\(display\|content\)\>"
|
|
|
|
|
|
|
|
|
|
syn keyword cssCascadeProp contained all
|
|
|
|
|
syn keyword cssCascadeAttr contained initial unset revert
|
|
|
|
|
|
|
|
|
|
syn keyword cssColorProp contained opacity
|
|
|
|
|
syn match cssColorProp contained "\<color-profile\>"
|
|
|
|
|
syn match cssColorProp contained "\<rendering-intent\>"
|
|
|
|
@ -273,10 +277,10 @@ syn match cssGeneratedContentAttr contained "\<\(no-\)\=\(open\|close\)-quote\>"
|
|
|
|
|
|
|
|
|
|
" https://www.w3.org/TR/css-grid-1/
|
|
|
|
|
syn match cssGridProp contained "\<grid\>"
|
|
|
|
|
syn match cssGridProp contained "\<grid\(-\(template\|auto\)\)\=\(-\(columns\|rows\|areas\)\)\>"
|
|
|
|
|
syn match cssGridProp contained "\<grid-template\(-\(columns\|rows\|areas\)\)\=\>"
|
|
|
|
|
syn match cssGridProp contained "\<grid-\(column\|row\)\(-\(start\|end\|gap\)\)\=\>"
|
|
|
|
|
syn match cssGridProp contained "\<grid-\(area\|gap\)\>"
|
|
|
|
|
syn match cssGridProp contained "\<grid-auto-flow\>"
|
|
|
|
|
syn match cssGridProp contained "\<grid-auto-\(flow\|rows\|columns\)\>"
|
|
|
|
|
|
|
|
|
|
syn match cssHyerlinkProp contained "\<target\(-\(name\|new\|position\)\)\=\>"
|
|
|
|
|
|
|
|
|
@ -295,6 +299,7 @@ syn match cssPositioningAttr contained "\<table\(-\(row-group\|\(header\|footer\
|
|
|
|
|
syn keyword cssPositioningAttr contained left right both
|
|
|
|
|
syn match cssPositioningAttr contained "\<list-item\>"
|
|
|
|
|
syn match cssPositioningAttr contained "\<inline\(-\(block\|box\|table\|grid\|flex\)\)\=\>"
|
|
|
|
|
syn match cssPositioningAttr contained "\<flow\(-root\)\=\>"
|
|
|
|
|
syn keyword cssPositioningAttr contained static relative absolute fixed subgrid
|
|
|
|
|
|
|
|
|
|
syn keyword cssPrintAttr contained landscape portrait crop cross always
|
|
|
|
@ -303,12 +308,13 @@ syn match cssTableProp contained "\<\(caption-side\|table-layout\|border-collaps
|
|
|
|
|
syn keyword cssTableAttr contained fixed collapse separate show hide once always
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
syn keyword cssTextProp contained color direction
|
|
|
|
|
syn keyword cssTextProp contained color direction hyphens
|
|
|
|
|
syn match cssTextProp "\<\(\(word\|letter\)-spacing\|text\(-\(decoration\|transform\|align\|index\|shadow\)\)\=\|vertical-align\|unicode-bidi\|line-height\)\>"
|
|
|
|
|
syn match cssTextProp contained "\<text-\(justify\|outline\|warp\|align-last\|size-adjust\|rendering\|stroke\|indent\)\>"
|
|
|
|
|
syn match cssTextProp contained "\<word-\(break\|\wrap\)\>"
|
|
|
|
|
syn match cssTextProp contained "\<\(word\|line\)-break\|\(overflow\|word\)-wrap\>"
|
|
|
|
|
syn match cssTextProp contained "\<white-space\>"
|
|
|
|
|
syn match cssTextProp contained "\<hanging-punctuation\>"
|
|
|
|
|
syn match cssTextProp contained "\<tab-size\>"
|
|
|
|
|
syn match cssTextProp contained "\<punctuation-trim\>"
|
|
|
|
|
syn match cssTextAttr contained "\<line-through\>"
|
|
|
|
|
syn match cssTextAttr contained "\<\(text-\)\=\(top\|bottom\)\>"
|
|
|
|
@ -316,7 +322,7 @@ syn keyword cssTextAttr contained ltr rtl embed nowrap
|
|
|
|
|
syn keyword cssTextAttr contained underline overline blink sub super middle
|
|
|
|
|
syn keyword cssTextAttr contained capitalize uppercase lowercase
|
|
|
|
|
syn keyword cssTextAttr contained justify baseline sub super
|
|
|
|
|
syn keyword cssTextAttr contained optimizeLegibility optimizeSpeed
|
|
|
|
|
syn keyword cssTextAttr contained optimizeLegibility optimizeSpeed geometricPrecision
|
|
|
|
|
syn match cssTextAttr contained "\<pre\(-\(line\|wrap\)\)\=\>"
|
|
|
|
|
syn match cssTextAttr contained "\<\(allow\|force\)-end\>"
|
|
|
|
|
syn keyword cssTextAttr contained start end adjacent
|
|
|
|
@ -325,7 +331,7 @@ syn keyword cssTextAttr contained distribute kashida first last
|
|
|
|
|
syn keyword cssTextAttr contained clip ellipsis unrestricted suppress
|
|
|
|
|
syn match cssTextAttr contained "\<break-all\>"
|
|
|
|
|
syn match cssTextAttr contained "\<break-word\>"
|
|
|
|
|
syn keyword cssTextAttr contained hyphenate
|
|
|
|
|
syn keyword cssTextAttr contained manual
|
|
|
|
|
syn match cssTextAttr contained "\<bidi-override\>"
|
|
|
|
|
|
|
|
|
|
syn match cssTransformProp contained "\<transform\(-\(origin\|style\)\)\=\>"
|
|
|
|
@ -408,13 +414,13 @@ syn keyword cssAuralAttr contained male female child code digits continuous
|
|
|
|
|
" mobile text
|
|
|
|
|
syn match cssMobileTextProp contained "\<text-size-adjust\>"
|
|
|
|
|
|
|
|
|
|
syn keyword cssMediaProp contained width height orientation scan grid
|
|
|
|
|
syn keyword cssMediaProp contained width height orientation scan
|
|
|
|
|
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
|
|
|
|
|
syn match cssKeyFrameProp /\d*%\|from\|to/ contained nextgroup=cssDefinition
|
|
|
|
|
syn match cssKeyFrameProp contained /\(\d\+\(\.\d\+\)\?%\|\(\<from\|to\>\)\)/ nextgroup=cssDefinition
|
|
|
|
|
syn match cssPageMarginProp /@\(\(top\|left\|right\|bottom\)-\(left\|center\|right\|middle\|bottom\)\)\(-corner\)\=/ contained nextgroup=cssDefinition
|
|
|
|
|
syn keyword cssPageProp contained content size
|
|
|
|
|
syn keyword cssPageProp contained orphans widows
|
|
|
|
@ -426,7 +432,7 @@ syn match cssFontDescriptorAttr contained "U+\x\+-\x\+"
|
|
|
|
|
|
|
|
|
|
syn match cssBraces contained "[{}]"
|
|
|
|
|
syn match cssError contained "{@<>"
|
|
|
|
|
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
|
|
|
|
|
syn region cssDefinition transparent matchgroup=cssBraces start='{' end='}' contains=cssTagName,cssAttributeSelector,cssClassName,cssIdentifier,cssAtRule,cssAttrRegion,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssCustomProp,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssHacks,cssNoise fold
|
|
|
|
|
syn match cssBraceError "}"
|
|
|
|
|
syn match cssAttrComma ","
|
|
|
|
|
|
|
|
|
@ -437,7 +443,7 @@ syn keyword cssPseudoClassId contained link visited active hover before after le
|
|
|
|
|
syn keyword cssPseudoClassId contained root empty target enable disabled checked invalid
|
|
|
|
|
syn match cssPseudoClassId contained "\<first-\(line\|letter\)\>"
|
|
|
|
|
syn match cssPseudoClassId contained "\<\(first\|last\|only\)-\(of-type\|child\)\>"
|
|
|
|
|
syn region cssPseudoClassFn contained matchgroup=cssFunctionName start="\<\(not\|lang\|\(nth\|nth-last\)-\(of-type\|child\)\)(" end=")"
|
|
|
|
|
syn region cssPseudoClassFn contained matchgroup=cssFunctionName start="\<\(not\|lang\|\(nth\|nth-last\)-\(of-type\|child\)\)(" end=")" contains=cssStringQ,cssStringQQ
|
|
|
|
|
" ------------------------------------
|
|
|
|
|
" Vendor specific properties
|
|
|
|
|
syn match cssPseudoClassId contained "\<selection\>"
|
|
|
|
@ -470,19 +476,20 @@ syn match cssHacks contained /\(_\|*\)/
|
|
|
|
|
|
|
|
|
|
" Attr Enhance
|
|
|
|
|
" Some keywords are both Prop and Attr, so we have to handle them
|
|
|
|
|
syn region cssAttrRegion start=/:/ end=/\ze\(;\|)\|}\)/ contained contains=css.*Attr,cssColor,cssImportant,cssValue.*,cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,cssError,cssAttrComma,cssNoise
|
|
|
|
|
" cssPseudoClassId is hidden by cssAttrRegion, so we add it here. see #69
|
|
|
|
|
syn region cssAttrRegion start=/:/ end=/\ze\(;\|)\|}\|{\)/ contained contains=cssPseudoClassId,css.*Attr,cssColor,cssImportant,cssValue.*,cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,cssError,cssAttrComma,cssNoise
|
|
|
|
|
|
|
|
|
|
" Hack for transition
|
|
|
|
|
" 'transition' has Props after ':'.
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
syn match cssAtKeyword /@\(font-face\|media\|keyframes\|import\|charset\|namespace\|page\|supports\)/ contained
|
|
|
|
|
syn match cssAtKeyword /@\(font-face\|media\|keyframes\|import\|charset\|namespace\|page\|supports\)/
|
|
|
|
|
|
|
|
|
|
syn keyword cssAtRuleLogical only not and contained
|
|
|
|
|
|
|
|
|
|
" @media
|
|
|
|
|
" Reference: http://www.w3.org/TR/css3-mediaqueries/
|
|
|
|
|
syn region cssAtRule start=/@media\>/ end=/\ze{/ skipwhite skipnl matchgroup=cssAtKeyword contains=cssMediaProp,cssValueLength,cssAtRuleLogical,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType,cssComment nextgroup=cssDefinition
|
|
|
|
|
syn region cssAtRule start=/@media\>/ end=/\ze{/ skipwhite skipnl matchgroup=cssAtKeyword contains=cssMediaProp,cssValueLength,cssAtRuleLogical,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType,cssComment,cssCustomProp,cssFunctionName nextgroup=cssDefinition
|
|
|
|
|
syn keyword cssMediaType contained screen print aural braille embossed handheld projection tty tv speech all contained
|
|
|
|
|
|
|
|
|
|
" @page
|
|
|
|
@ -497,9 +504,6 @@ syn region cssAtRule start=/@import\>/ end=/\ze;/ contains=cssStringQ,cssStri
|
|
|
|
|
syn region cssAtRule start=/@charset\>/ end=/\ze;/ contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssAtKeyword
|
|
|
|
|
syn region cssAtRule start=/@namespace\>/ end=/\ze;/ contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssAtKeyword
|
|
|
|
|
|
|
|
|
|
" @font-face
|
|
|
|
|
" http://www.w3.org/TR/css3-fonts/#at-font-face-rule
|
|
|
|
|
syn match cssAtRule "@font-face\>" nextgroup=cssFontDescriptorBlock
|
|
|
|
|
" @supports
|
|
|
|
|
" https://www.w3.org/TR/css3-conditional/#at-supports
|
|
|
|
|
syn region cssAtRule start=/@supports\>/ end=/\ze{/ skipwhite skipnl contains=cssAtRuleLogical,cssAttrRegion,css.*Prop,cssValue.*,cssVendor,cssAtKeyword,cssComment nextgroup=cssDefinition
|
|
|
|
@ -525,6 +529,7 @@ hi def link cssAnimationProp cssProp
|
|
|
|
|
hi def link cssBackgroundProp cssProp
|
|
|
|
|
hi def link cssBorderProp cssProp
|
|
|
|
|
hi def link cssBoxProp cssProp
|
|
|
|
|
hi def link cssCascadeProp cssProp
|
|
|
|
|
hi def link cssColorProp cssProp
|
|
|
|
|
hi def link cssContentForPagedMediaProp cssProp
|
|
|
|
|
hi def link cssDimensionProp cssProp
|
|
|
|
@ -585,6 +590,7 @@ hi def link cssUIAttr cssAttr
|
|
|
|
|
hi def link cssIEUIAttr cssAttr
|
|
|
|
|
hi def link cssAuralAttr cssAttr
|
|
|
|
|
hi def link cssRenderAttr cssAttr
|
|
|
|
|
hi def link cssCascadeAttr cssAttr
|
|
|
|
|
hi def link cssCommonAttr cssAttr
|
|
|
|
|
|
|
|
|
|
hi def link cssPseudoClassId PreProc
|
|
|
|
@ -604,6 +610,7 @@ hi def link cssIdentifier Function
|
|
|
|
|
hi def link cssAtRule Include
|
|
|
|
|
hi def link cssAtKeyword PreProc
|
|
|
|
|
hi def link cssImportant Special
|
|
|
|
|
hi def link cssCustomProp Special
|
|
|
|
|
hi def link cssBraces Function
|
|
|
|
|
hi def link cssBraceError Error
|
|
|
|
|
hi def link cssError Error
|
|
|
|
|