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