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