589
|
1 " Vim syntax file
|
|
2 " Language: less
|
|
3 " Maintainer: Alessandro Vioni <jenoma@gmail.com>
|
|
4 " URL: https://github.com/genoma/vim-less
|
|
5 " Last Change: 2014 November 24
|
|
6
|
540
|
7 if exists("b:current_syntax")
|
|
8 finish
|
|
9 endif
|
|
10
|
|
11 runtime! syntax/css.vim
|
|
12 runtime! after/syntax/css.vim
|
|
13
|
|
14 syn case ignore
|
|
15
|
589
|
16 syn cluster lessCssProperties contains=cssFontProp,cssFontDescriptorProp,cssColorProp,cssTextProp,cssBoxProp,cssGeneratedContentProp,cssPagingProp,cssUIProp,cssRenderProp,cssAuralProp,cssTableProp
|
|
17 syn cluster lessCssAttributes contains=css.*Attr,lessEndOfLineComment,lessComment,cssValue.*,cssColor,cssURL,lessDefault,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssRenderProp
|
|
18
|
|
19 syn region lessDefinition matchgroup=cssBraces start="{" end="}" contains=TOP
|
540
|
20
|
589
|
21 syn match lessProperty "\%([{};]\s*\|^\)\@<=\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:" contains=css.*Prop skipwhite nextgroup=lessCssAttribute contained containedin=lessDefinition
|
|
22 syn match lessProperty "^\s*\zs\s\%(\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:\|:[[:alnum:]-]\+\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=lessCssAttribute
|
|
23 syn match lessProperty "^\s*\zs\s\%(:\=[[:alnum:]-]\+\s*=\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=lessCssAttribute
|
|
24 syn match lessCssAttribute +\%("\%([^"]\|\\"\)*"\|'\%([^']\|\\'\)*'\|#{[^{}]*}\|[^{};]\)*+ contained contains=@lessCssAttributes,lessVariable,lessFunction,lessInterpolation
|
|
25 syn match lessDefault "!default\>" contained
|
540
|
26
|
589
|
27 " less variables and media queries
|
|
28 syn match lessVariable "@[[:alnum:]_-]\+" nextgroup=lessCssAttribute skipwhite
|
|
29 syn match lessMedia "@media" nextgroup=lessCssAttribute skipwhite
|
540
|
30
|
589
|
31 " Less functions
|
|
32 syn match lessFunction "\<\%(escape\|e\|unit\)\>(\@=" contained
|
|
33 syn match lessFunction "\<\%(ceil\|floor\|percentage\|round\|sqrt\|abs\|sin\|asin\|cos\|acos\|tan\|atan\|pi\|pow\|min\|max\)\>(\@=" contained
|
|
34 syn match lessFunction "\<\%(rgb\|rgba\|argb\|argb\|hsl\|hsla\|hsv\|hsva\)\>(\@=" contained
|
|
35 syn match lessFunction "\<\%(hue\|saturation\|lightness\|red\|green\|blue\|alpha\|luma\)\>(\@=" contained
|
|
36 syn match lessFunction "\<\%(saturate\|desaturate\|lighten\|darken\|fadein\|fadeout\|fade\|spin\|mix\|greyscale\|contrast\)\>(\@=" contained
|
|
37 syn match lessFunction "\<\%(multiply\|screen\|overlay\|softlight\|hardlight\|difference\|exclusion\|average\|negation\)\>(\@=" contained
|
540
|
38
|
589
|
39 " Less id class visualization
|
|
40 syn match lessIdChar "#[[:alnum:]_-]\@=" nextgroup=lessId,lessClassIdCall
|
|
41 syn match lessId "[[:alnum:]_-]\+" contained
|
|
42 syn match lessClassIdCall "[[:alnum:]_-]\+()" contained
|
540
|
43
|
589
|
44 syn match lessClassChar "\.[[:alnum:]_-]\@=" nextgroup=lessClass,lessClassCall
|
|
45 syn match lessClass "[[:alnum:]_-]\+" contained
|
|
46 syn match lessClassCall "[[:alnum:]_-]\+()" contained
|
|
47
|
|
48 syn match lessAmpersand "&" contains=lessIdChar,lessClassChar
|
|
49
|
|
50 syn region lessInclude start="@import" end=";\|$" contains=lessComment,cssURL,cssUnicodeEscape,cssMediaType,cssStringQ,cssStringQQ
|
|
51
|
|
52 syn keyword lessTodo FIXME NOTE TODO OPTIMIZE XXX contained
|
|
53 syn region lessComment start="^\z(\s*\)//" end="^\%(\z1 \)\@!" contains=lessTodo,@Spell
|
|
54 syn region lessCssComment start="^\z(\s*\)/\*" end="^\%(\z1 \)\@!" contains=lessTodo,@Spell
|
|
55 syn match lessEndOfLineComment "//.*" contains=lessComment,lessTodo,@Spell
|
540
|
56
|
589
|
57 hi def link lessEndOfLineComment lessComment
|
|
58 hi def link lessCssComment lessComment
|
|
59 hi def link lessComment Comment
|
|
60 hi def link lessDefault cssImportant
|
|
61 hi def link lessVariable Identifier
|
|
62 hi def link lessFunction PreProc
|
|
63 hi def link lessTodo Todo
|
|
64 hi def link lessInclude Include
|
|
65 hi def link lessIdChar Special
|
|
66 hi def link lessClassChar Special
|
|
67 hi def link lessAmpersand Character
|
|
68 hi def link lessId Identifier
|
|
69 hi def link lessClass Type
|
|
70 hi def link lessCssAttribute PreProc
|
|
71 hi def link lessClassCall Type
|
|
72 hi def link lessClassIdCall Type
|
|
73 hi def link lessTagName cssTagName
|
|
74 hi def link lessDeprecated cssDeprecated
|
|
75 hi def link lessMedia cssMedia
|
540
|
76
|
|
77 let b:current_syntax = "less"
|
589
|
78
|
|
79 " vim:set sw=2:
|