comparison rc/vim-syntax-scss @ 393:0aabb2b34ef6

Added scss vim syntax support.
author Edho Arief <edho@myconan.net>
date Wed, 01 Aug 2012 15:17:56 +0700
parents
children
comparison
equal deleted inserted replaced
392:e385db8cd360 393:0aabb2b34ef6
1 " Vim syntax file
2 " Language: SCSS (Sassy CSS)
3 " Author: Daniel Hofstetter (daniel.hofstetter@42dh.com)
4 " Inspired by the syntax files for sass and css. Thanks to the authors of
5 " those files!
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 region scssDefinition transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssUrl,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,scssDefinition,scssComment,scssIdChar,scssClassChar,scssAmpersand,scssVariable,scssInclude,scssExtend,scssDebug,scssWarn,@scssControl,scssInterpolation,scssNestedSelector,scssReturn
16
17 syn region scssInterpolation start="#{" end="}" contains=scssVariable
18
19 syn match scssVariable "$[[:alnum:]_-]\+" nextgroup=scssVariableAssignment
20 syn match scssVariableAssignment ":" contained nextgroup=scssVariableValue
21 syn match scssVariableValue ".*;"me=e-1 contained contains=scssVariable,scssOperator,scssDefault "me=e-1 means that the last char of the pattern is not highlighted
22 syn match scssMixin "^@mixin" nextgroup=scssMixinName
23 syn match scssMixinName " [[:alnum:]_-]\+" contained nextgroup=scssDefinition
24 syn match scssFunction "^@function" nextgroup=scssFunctionName
25 syn match scssFunctionName " [[:alnum:]_-]\+" contained nextgroup=scssDefinition
26 syn match scssReturn "@return" contained
27 syn match scssInclude "@include" nextgroup=scssMixinName
28 syn match scssExtend "@extend .*[;}]"me=e-1 contains=cssTagName,scssIdChar,scssClassChar
29
30 syn match scssColor "#[0-9A-Fa-f]\{3\}\>" contained
31 syn match scssColor "#[0-9A-Fa-f]\{6\}\>" contained
32
33 syn match scssIdChar "#[[:alnum:]_-]\@=" nextgroup=scssId contains=scssColor
34 syn match scssId "[[:alnum:]_-]\+" contained
35 syn match scssClassChar "\.[[:alnum:]_-]\@=" nextgroup=scssClass
36 syn match scssClass "[[:alnum:]_-]\+" contained
37 syn match scssAmpersand "&" nextgroup=cssPseudoClass
38
39 syn match scssOperator "+" contained
40 syn match scssOperator "-" contained
41 syn match scssOperator "/" contained
42 syn match scssOperator "*" contained
43
44 syn match scssNestedSelector "[^/]* {"me=e-1 contained contains=cssTagName,cssAttributeSelector,scssIdChar,scssClassChar,scssAmpersand,scssVariable,scssMixin,scssFunction,@scssControl,scssInterpolation,scssNestedProperty
45 syn match scssNestedProperty "[[:alnum:]]\+:"me=e-1 contained
46
47 syn match scssDebug "@debug"
48 syn match scssWarn "@warn"
49 syn match scssDefault "!default" contained
50
51 syn match scssIf "@if"
52 syn match scssElse "@else"
53 syn match scssElseIf "@else if"
54 syn match scssWhile "@while"
55 syn match scssFor "@for" nextgroup=scssVariable
56 syn match scssFrom " from "
57 syn match scssTo " to "
58 syn match scssThrough " through "
59 syn match scssEach "@each" nextgroup=scssVariable
60 syn match scssIn " in "
61 syn cluster scssControl contains=scssIf,scssElse,scssElseIf,scssWhile,scssFor,scssFrom,scssTo,scssThrough,scssEach,scssIn
62
63 syn match scssComment "//.*$" contains=@Spell
64 syn region scssImportStr start="\"" end="\""
65 syn region scssImport start="@import" end=";" contains=scssImportStr,scssComment,cssComment,cssUnicodeEscape,cssMediaType
66
67 hi def link scssVariable Identifier
68 hi def link scssVariableValue Constant
69 hi def link scssMixin PreProc
70 hi def link scssMixinName Function
71 hi def link scssFunction PreProc
72 hi def link scssFunctionName Function
73 hi def link scssReturn Statement
74 hi def link scssInclude PreProc
75 hi def link scssExtend PreProc
76 hi def link scssComment Comment
77 hi def link scssColor Constant
78 hi def link scssIdChar Special
79 hi def link scssClassChar Special
80 hi def link scssId Identifier
81 hi def link scssClass Identifier
82 hi def link scssAmpersand Character
83 hi def link scssNestedProperty Type
84 hi def link scssDebug Debug
85 hi def link scssWarn Debug
86 hi def link scssDefault Special
87 hi def link scssIf Conditional
88 hi def link scssElse Conditional
89 hi def link scssElseIf Conditional
90 hi def link scssWhile Repeat
91 hi def link scssFor Repeat
92 hi def link scssFrom Repeat
93 hi def link scssTo Repeat
94 hi def link scssThrough Repeat
95 hi def link scssEach Repeat
96 hi def link scssIn Repeat
97 hi def link scssInterpolation Delimiter
98 hi def link scssImport Include
99 hi def link scssImportStr Include
100
101 let b:current_syntax = "scss"