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