blob: d8bf641e60dcc9a05837d4c0d85c0c58d38d74e0 [file] [log] [blame]
Philip H2d919d22024-05-01 18:42:11 +02001" Vim syntax file
2" Language: Stylus
3" Maintainer: Hsiaoming Yang <lepture@me.com>, Marc Harter
4" Filenames: *.styl, *.stylus
5" Based On: Tim Pope (sass.vim)
6" Created: Dec 14, 2011
zeertzjq0b74eec2024-05-28 14:23:41 +08007" Modified: May 28, 2024
Philip H2d919d22024-05-01 18:42:11 +02008
9syn case ignore
10
11syn cluster stylusCssSelectors contains=cssTagName,cssSelector,cssPseudo
12syn cluster stylusCssValues contains=cssValueLength,cssValueInteger,cssValueNumber,cssValueAngle,cssValueTime,cssValueFrequency,cssColorVal,cssCommonVal,cssFontVal,cssListVal,cssTextVal,cssVisualVal,cssBorderVal,cssBackgroundVal,cssFuncVal,cssAdvancedVal
13syn cluster stylusCssProperties contains=cssProp,cssBackgroundProp,cssTableProp,cssBorderProp,cssFontProp,cssColorProp,cssBoxProp,cssTextProp,cssListProp,cssVisualProp,cssAdvancedProp,cssCommonProp,cssSpecialProp
14
15syn match stylusVariable "$\?[[:alnum:]_-]\+"
16syn match stylusVariableAssignment "\%([[:alnum:]_-]\+\s*\)\@<==" nextgroup=stylusCssAttribute,stylusVariable skipwhite
17
18syn match stylusProperty "\%([{};]\s*\|^\)\@<=\%([[:alnum:]-]\|#{[^{}]*}\)\+:" contains=@stylusCssProperties,@stylusCssSelectors skipwhite nextgroup=stylusCssAttribute contained containedin=cssDefineBlock
19syn match stylusProperty "^\s*\zs\s\%(\%([[:alnum:]-]\|#{[^{}]*}\)\+[ :]\|:[[:alnum:]-]\+\)"hs=s+1 contains=@stylusCssProperties,@stylusCssSelectors skipwhite nextgroup=stylusCssAttribute
20syn match stylusProperty "^\s*\zs\s\%(:\=[[:alnum:]-]\+\s*=\)"hs=s+1 contains=@stylusCssProperties,@stylusCssSelectors skipwhite nextgroup=stylusCssAttribute
21
22syn match stylusCssAttribute +\%("\%([^"]\|\\"\)*"\|'\%([^']\|\\'\)*'\|#{[^{}]*}\|[^{};]\)*+ contained contains=@stylusCssValues,cssImportant,stylusFunction,stylusVariable,stylusControl,stylusUserFunction,stylusInterpolation,cssString,stylusComment,cssComment
23
24syn match stylusInterpolation %{[[:alnum:]_-]\+}%
25
26syn match stylusFunction "\<\%(red\|green\|blue\|alpha\|dark\|light\)\>(\@=" contained
27syn match stylusFunction "\<\%(hue\|saturation\|lightness\|push\|unshift\|typeof\|unit\|match\)\>(\@=" contained
28syn match stylusFunction "\<\%(hsla\|hsl\|rgba\|rgb\|lighten\|darken\)\>(\@=" contained
29syn match stylusFunction "\<\%(abs\|ceil\|floor\|round\|min\|max\|even\|odd\|sum\|avg\|sin\|cos\|join\)\>(\@=" contained
30syn match stylusFunction "\<\%(desaturate\|saturate\|invert\|unquote\|quote\|s\)\>(\@=" contained
31syn match stylusFunction "\<\%(operate\|length\|warn\|error\|last\|p\|\)\>(\@=" contained
32syn match stylusFunction "\<\%(opposite-position\|image-size\|add-property\)\>(\@=" contained
33
34syn keyword stylusVariable null true false arguments
35syn keyword stylusControl if else unless for in return
36
37syn match stylusImport "@\%(import\|require\)" nextgroup=stylusImportList
38syn match stylusImportList "[^;]\+" contained contains=cssString.*,cssMediaType,cssURL
39
40syn match stylusAmpersand "&"
41syn match stylusClass "[[:alnum:]_-]\+" contained
42syn match stylusClassChar "\.[[:alnum:]_-]\@=" nextgroup=stylusClass
43syn match stylusEscape "^\s*\zs\\"
44syn match stylusId "[[:alnum:]_-]\+" contained
45syn match stylusIdChar "#[[:alnum:]_-]\@=" nextgroup=stylusId
46
47syn region stylusComment start="//" end="$" contains=cssTodo,@Spell fold
48
49let b:current_syntax = "stylus"
50
51" vim:set sw=2: