blob: fd0f33b65a9f5172164087d249009f4817ed45c1 [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
7" Modified: Apr 29, 2024
8
9if main_syntax == "css"
10 syn sync minlines=10
11endif
12
13" let b:current_syntax = "css"
14"
15if main_syntax == 'css'
16 unlet main_syntax
17endif
18
19syn case ignore
20
21syn cluster stylusCssSelectors contains=cssTagName,cssSelector,cssPseudo
22syn cluster stylusCssValues contains=cssValueLength,cssValueInteger,cssValueNumber,cssValueAngle,cssValueTime,cssValueFrequency,cssColorVal,cssCommonVal,cssFontVal,cssListVal,cssTextVal,cssVisualVal,cssBorderVal,cssBackgroundVal,cssFuncVal,cssAdvancedVal
23syn cluster stylusCssProperties contains=cssProp,cssBackgroundProp,cssTableProp,cssBorderProp,cssFontProp,cssColorProp,cssBoxProp,cssTextProp,cssListProp,cssVisualProp,cssAdvancedProp,cssCommonProp,cssSpecialProp
24
25syn match stylusVariable "$\?[[:alnum:]_-]\+"
26syn match stylusVariableAssignment "\%([[:alnum:]_-]\+\s*\)\@<==" nextgroup=stylusCssAttribute,stylusVariable skipwhite
27
28syn match stylusProperty "\%([{};]\s*\|^\)\@<=\%([[:alnum:]-]\|#{[^{}]*}\)\+:" contains=@stylusCssProperties,@stylusCssSelectors skipwhite nextgroup=stylusCssAttribute contained containedin=cssDefineBlock
29syn match stylusProperty "^\s*\zs\s\%(\%([[:alnum:]-]\|#{[^{}]*}\)\+[ :]\|:[[:alnum:]-]\+\)"hs=s+1 contains=@stylusCssProperties,@stylusCssSelectors skipwhite nextgroup=stylusCssAttribute
30syn match stylusProperty "^\s*\zs\s\%(:\=[[:alnum:]-]\+\s*=\)"hs=s+1 contains=@stylusCssProperties,@stylusCssSelectors skipwhite nextgroup=stylusCssAttribute
31
32syn match stylusCssAttribute +\%("\%([^"]\|\\"\)*"\|'\%([^']\|\\'\)*'\|#{[^{}]*}\|[^{};]\)*+ contained contains=@stylusCssValues,cssImportant,stylusFunction,stylusVariable,stylusControl,stylusUserFunction,stylusInterpolation,cssString,stylusComment,cssComment
33
34syn match stylusInterpolation %{[[:alnum:]_-]\+}%
35
36syn match stylusFunction "\<\%(red\|green\|blue\|alpha\|dark\|light\)\>(\@=" contained
37syn match stylusFunction "\<\%(hue\|saturation\|lightness\|push\|unshift\|typeof\|unit\|match\)\>(\@=" contained
38syn match stylusFunction "\<\%(hsla\|hsl\|rgba\|rgb\|lighten\|darken\)\>(\@=" contained
39syn match stylusFunction "\<\%(abs\|ceil\|floor\|round\|min\|max\|even\|odd\|sum\|avg\|sin\|cos\|join\)\>(\@=" contained
40syn match stylusFunction "\<\%(desaturate\|saturate\|invert\|unquote\|quote\|s\)\>(\@=" contained
41syn match stylusFunction "\<\%(operate\|length\|warn\|error\|last\|p\|\)\>(\@=" contained
42syn match stylusFunction "\<\%(opposite-position\|image-size\|add-property\)\>(\@=" contained
43
44syn keyword stylusVariable null true false arguments
45syn keyword stylusControl if else unless for in return
46
47syn match stylusImport "@\%(import\|require\)" nextgroup=stylusImportList
48syn match stylusImportList "[^;]\+" contained contains=cssString.*,cssMediaType,cssURL
49
50syn match stylusAmpersand "&"
51syn match stylusClass "[[:alnum:]_-]\+" contained
52syn match stylusClassChar "\.[[:alnum:]_-]\@=" nextgroup=stylusClass
53syn match stylusEscape "^\s*\zs\\"
54syn match stylusId "[[:alnum:]_-]\+" contained
55syn match stylusIdChar "#[[:alnum:]_-]\@=" nextgroup=stylusId
56
57syn region stylusComment start="//" end="$" contains=cssTodo,@Spell fold
58
59let b:current_syntax = "stylus"
60
61" vim:set sw=2: