comparison vendor/vim-syntax/less.vim @ 540:50fd59a959ea

Add support for lesscss.
author edogawaconan <me@myconan.net>
date Tue, 06 Jan 2015 03:25:01 +0900
parents
children 7fbadf8bd22e
comparison
equal deleted inserted replaced
539:05785a85d603 540:50fd59a959ea
1 if exists("b:current_syntax")
2 finish
3 endif
4
5 runtime! syntax/css.vim
6 runtime! after/syntax/css.vim
7 " load files from vim-css3-syntax plugin (https://github.com/hail2u/vim-css3-syntax)
8 runtime! after/syntax/css/*.vim
9
10 syn case ignore
11
12 syn region lessDefinition transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssTagName,cssPseudoClass,cssUrl,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,lessDefinition,lessComment,lessClassChar,lessVariable,lessMixinChar,lessAmpersandChar,lessFunction,lessNestedSelector,@cssColors fold
13
14 syn match lessVariable "@[[:alnum:]_-]\+" contained
15 syn match lessVariable "@[[:alnum:]_-]\+" nextgroup=lessVariableAssignment skipwhite
16 syn match lessVariableAssignment ":" contained nextgroup=lessVariableValue skipwhite
17 syn match lessVariableValue ".*;"me=e-1 contained contains=lessVariable,lessOperator,lessDefault,cssValue.*,@cssColors "me=e-1 means that the last char of the pattern is not highlighted
18
19 syn match lessOperator "+" contained
20 syn match lessOperator "-" contained
21 syn match lessOperator "/" contained
22 syn match lessOperator "*" contained
23
24 syn match lessNestedSelector "[^/]* {"me=e-1 contained contains=cssTagName,cssAttributeSelector,lessAmpersandChar,lessVariable,lessMixinChar,lessFunction,lessNestedProperty
25 syn match lessNestedProperty "[[:alnum:]]\+:"me=e-1 contained
26
27 syn match lessDefault "!default" contained
28
29 syn match lessMixinChar "\.[[:alnum:]_-]\@=" contained nextgroup=lessClass
30 syn match lessAmpersandChar "&" contained nextgroup=lessClass,cssPseudoClass
31 syn match lessClass "[[:alnum:]_-]\+" contained
32
33 " functions {{{
34
35 " string functions
36 syn keyword lessFunction escape e % containedin=cssDefinition contained
37 " misc functions
38 syn keyword lessFunction unit containedin=cssDefinition contained
39 " math functions
40 syn keyword lessFunction ceil floor percentage round containedin=cssDefinition contained
41 " color definition
42 syn keyword lessFunction rgb rgba argb hsl hsla hsv hsva containedin=cssDefinition contained
43 " color channel information
44 syn keyword lessFunction hue saturation lightness red green blue alpha luma containedin=cssDefinition contained
45 " color operations
46 syn keyword lessFunction saturate desaturate lighten darken fadein fadeout fade spin mix greyscale contrast containedin=cssDefinition contained
47 " color blending
48 syn keyword lessFunction multiply screen overlay softlight hardlight difference exclusion average negation containedin=cssDefinition contained
49
50 " }}}
51
52 syn match lessComment "//.*$" contains=@Spell
53
54 hi def link lessVariable Special
55 hi def link lessVariableValue Constant
56 hi def link lessDefault Special
57 hi def link lessComment Comment
58 hi def link lessFunction Function
59 hi def link lessMixinChar Special
60 hi def link lessAmpersandChar Special
61 hi def link lessNestedProperty Type
62 hi def link lessClass PreProc
63
64 let b:current_syntax = "less"