1668
|
1 " Vim syntax file
|
2415
|
2 " Language: Sass
|
|
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
|
4 " Filenames: *.sass
|
|
5 " Last Change: 2010 Jul 26
|
1668
|
6
|
|
7 if exists("b:current_syntax")
|
|
8 finish
|
|
9 endif
|
|
10
|
|
11 runtime! syntax/css.vim
|
|
12
|
|
13 syn case ignore
|
|
14
|
|
15 syn cluster sassCssProperties contains=cssFontProp,cssFontDescriptorProp,cssColorProp,cssTextProp,cssBoxProp,cssGeneratedContentProp,cssPagingProp,cssUIProp,cssRenderProp,cssAuralProp,cssTableProp
|
2415
|
16 syn cluster sassCssAttributes contains=css.*Attr,scssComment,cssValue.*,cssColor,cssURL,sassDefault,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssRenderProp
|
1668
|
17
|
2415
|
18 syn region sassDefinition matchgroup=cssBraces start="{" end="}" contains=TOP
|
|
19
|
|
20 syn match sassProperty "\%([{};]\s*\|^\)\@<=[[:alnum:]-]\+:" contains=css.*Prop skipwhite nextgroup=sassCssAttribute contained containedin=sassDefinition
|
1668
|
21 syn match sassProperty "^\s*\zs\s\%([[:alnum:]-]\+:\|:[[:alnum:]-]\+\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassCssAttribute
|
2415
|
22 syn match sassProperty "^\s*\zs\s\%(:\=[[:alnum:]-]\+\s*=\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassCssAttribute
|
|
23 syn match sassCssAttribute +\%("\%([^"]\|\\"\)*"\|'\%([^']\|\\'\)*'\|[^{};]\)*+ contained contains=@sassCssAttributes,sassVariable,sassFunction
|
|
24 syn match sassDefault "!default\>" contained
|
|
25 syn match sassVariable "!\%(important\>\|default\>\)\@![[:alnum:]_-]\+"
|
|
26 syn match sassVariable "$[[:alnum:]_-]\+"
|
|
27 syn match sassVariableAssignment "\%([!$][[:alnum:]_-]\+\s*\)\@<=\%(||\)\==" nextgroup=sassCssAttribute skipwhite
|
|
28 syn match sassVariableAssignment "\%([!$][[:alnum:]_-]\+\s*\)\@<=:" nextgroup=sassCssAttribute skipwhite
|
|
29
|
|
30 syn match sassFunction "\<\%(rgb\|rgba\|red\|green\|blue\|mix\)\>(\@=" contained
|
|
31 syn match sassFunction "\<\%(hsl\|hsla\|hue\|saturation\|lightness\|adjust-hue\|lighten\|darken\|saturate\|desaturate\|grayscale\|complement\)\>(\@=" contained
|
|
32 syn match sassFunction "\<\%(alpha\|opacity\|rgba\|opacify\|fade-in\|transparentize\|fade-out\)\>(\@=" contained
|
|
33 syn match sassFunction "\<\%(unquote\|quote\)\>(\@=" contained
|
|
34 syn match sassFunction "\<\%(percentage\|round\|ceil\|floor\|abs\)\>(\@=" contained
|
|
35 syn match sassFunction "\<\%(type-of\|unit\|unitless\|comparable\)\>(\@=" contained
|
|
36
|
|
37 syn region sassInterpolation matchgroup=sassInterpolationDelimiter start="#{" end="}" contains=@sassCssAttributes,sassVariable,sassFunction containedin=cssStringQ,cssStringQQ
|
|
38
|
|
39 syn match sassMixinName "[[:alnum:]_-]\+" contained nextgroup=sassCssAttribute
|
|
40 syn match sassMixin "^=" nextgroup=sassMixinName
|
|
41 syn match sassMixin "^\s*\zs@mixin" nextgroup=sassMixinName skipwhite
|
|
42 syn match sassMixing "^\s\+\zs+" nextgroup=sassMixinName
|
|
43 syn match sassMixing "^\s\+\zs@include" nextgroup=sassMixinName skipwhite
|
|
44 syn match sassMixing "\%([{};]\s*\|^\)\@<=@include" nextgroup=sassMixinName skipwhite contained containedin=sassDefinition
|
|
45 syn match sassExtend "^\s\+\zs@extend"
|
1668
|
46
|
|
47 syn match sassEscape "^\s*\zs\\"
|
|
48 syn match sassIdChar "#[[:alnum:]_-]\@=" nextgroup=sassId
|
|
49 syn match sassId "[[:alnum:]_-]\+" contained
|
|
50 syn match sassClassChar "\.[[:alnum:]_-]\@=" nextgroup=sassClass
|
|
51 syn match sassClass "[[:alnum:]_-]\+" contained
|
|
52 syn match sassAmpersand "&"
|
|
53
|
|
54 " TODO: Attribute namespaces
|
|
55 " TODO: Arithmetic (including strings and concatenation)
|
|
56
|
2415
|
57 syn region sassInclude start="@import" end=";\|$" contains=scssComment,cssURL,cssUnicodeEscape,cssMediaType
|
|
58 syn region sassDebugLine end=";\|$" matchgroup=sassDebug start="@debug\>" contains=@sassCssAttributes,sassVariable,sassFunction
|
|
59 syn region sassWarnLine end=";\|$" matchgroup=sassWarn start="@warn\>" contains=@sassCssAttributes,sassVariable,sassFunction
|
|
60 syn region sassControlLine matchgroup=sassControl start="@\%(if\|else\%(\s\+if\)\=\|while\|for\)\>" end="[{};]\@=\|$" contains=sassFor,@sassCssAttributes,sassVariable,sassFunction
|
2202
|
61 syn keyword sassFor from to through contained
|
1668
|
62
|
|
63 syn keyword sassTodo FIXME NOTE TODO OPTIMIZE XXX contained
|
2415
|
64 syn region sassComment start="^\z(\s*\)//" end="^\%(\z1 \)\@!" contains=sassTodo,@Spell
|
|
65 syn region sassCssComment start="^\z(\s*\)/\*" end="^\%(\z1 \)\@!" contains=sassTodo,@Spell
|
1668
|
66
|
|
67 hi def link sassCssComment sassComment
|
|
68 hi def link sassComment Comment
|
2415
|
69 hi def link sassDefault cssImportant
|
|
70 hi def link sassVariable Identifier
|
|
71 hi def link sassFunction Function
|
1668
|
72 hi def link sassMixing PreProc
|
|
73 hi def link sassMixin PreProc
|
2415
|
74 hi def link sassExtend PreProc
|
1668
|
75 hi def link sassTodo Todo
|
|
76 hi def link sassInclude Include
|
2415
|
77 hi def link sassDebug sassControl
|
|
78 hi def link sassWarn sassControl
|
2202
|
79 hi def link sassControl PreProc
|
|
80 hi def link sassFor PreProc
|
1668
|
81 hi def link sassEscape Special
|
|
82 hi def link sassIdChar Special
|
|
83 hi def link sassClassChar Special
|
2415
|
84 hi def link sassInterpolationDelimiter Delimiter
|
1668
|
85 hi def link sassAmpersand Character
|
|
86 hi def link sassId Identifier
|
|
87 hi def link sassClass Type
|
|
88
|
|
89 let b:current_syntax = "sass"
|
|
90
|
|
91 " vim:set sw=2:
|