Mercurial > ec-dotfiles
annotate vendor/vim-syntax/slim.vim @ 619:7045cd713864
Simpler variable
author | nanaya <me@nanaya.pro> |
---|---|
date | Mon, 09 Jul 2018 16:08:46 +0900 |
parents | 7fbadf8bd22e |
children | c548e83e4c57 |
rev | line source |
---|---|
475 | 1 " Vim syntax file |
2 " Language: Slim | |
3 " Maintainer: Andrew Stone <andy@stonean.com> | |
4 " Version: 1 | |
5 " Last Change: 2010 Sep 25 | |
6 " TODO: Feedback is welcomed. | |
7 | |
8 " Quit when a syntax file is already loaded. | |
9 if exists("b:current_syntax") | |
10 finish | |
11 endif | |
12 | |
13 if !exists("main_syntax") | |
14 let main_syntax = 'slim' | |
15 endif | |
16 | |
17 " Allows a per line syntax evaluation. | |
18 let b:ruby_no_expensive = 1 | |
19 | |
20 " Include Ruby syntax highlighting | |
21 syn include @slimRubyTop syntax/ruby.vim | |
22 unlet! b:current_syntax | |
23 " Include Haml syntax highlighting | |
24 syn include @slimHaml syntax/haml.vim | |
25 unlet! b:current_syntax | |
26 | |
27 syn match slimBegin "^\s*\(&[^= ]\)\@!" nextgroup=slimTag,slimClassChar,slimIdChar,slimRuby | |
28 | |
29 syn region rubyCurlyBlock start="{" end="}" contains=@slimRubyTop contained | |
30 syn cluster slimRubyTop add=rubyCurlyBlock | |
31 | |
32 syn cluster slimComponent contains=slimClassChar,slimIdChar,slimWrappedAttrs,slimRuby,slimAttr,slimInlineTagChar | |
33 | |
34 syn keyword slimDocType contained html 5 1.1 strict frameset mobile basic transitional | |
35 syn match slimDocTypeKeyword "^\s*\(doctype\)\s\+" nextgroup=slimDocType | |
36 | |
37 syn keyword slimTodo FIXME TODO NOTE OPTIMIZE XXX contained | |
508
bbcffc594d1e
Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
475
diff
changeset
|
38 syn keyword htmlTagName contained script |
475 | 39 |
508
bbcffc594d1e
Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
475
diff
changeset
|
40 syn match slimTag "\w\+[><]*" contained contains=htmlTagName nextgroup=@slimComponent |
475 | 41 syn match slimIdChar "#{\@!" contained nextgroup=slimId |
42 syn match slimId "\%(\w\|-\)\+" contained nextgroup=@slimComponent | |
43 syn match slimClassChar "\." contained nextgroup=slimClass | |
44 syn match slimClass "\%(\w\|-\)\+" contained nextgroup=@slimComponent | |
45 syn match slimInlineTagChar "\s*:\s*" contained nextgroup=slimTag,slimClassChar,slimIdChar | |
46 | |
47 syn region slimWrappedAttrs matchgroup=slimWrappedAttrsDelimiter start="\s*{\s*" skip="}\s*\"" end="\s*}\s*" contained contains=slimAttr nextgroup=slimRuby | |
48 syn region slimWrappedAttrs matchgroup=slimWrappedAttrsDelimiter start="\s*\[\s*" end="\s*\]\s*" contained contains=slimAttr nextgroup=slimRuby | |
49 syn region slimWrappedAttrs matchgroup=slimWrappedAttrsDelimiter start="\s*(\s*" end="\s*)\s*" contained contains=slimAttr nextgroup=slimRuby | |
50 | |
537 | 51 syn match slimAttr /\s*\%(\w\|-\)\+\s*=/me=e-1 contained contains=htmlArg nextgroup=slimAttrAssignment |
475 | 52 syn match slimAttrAssignment "\s*=\s*" contained nextgroup=slimWrappedAttrValue,slimAttrString |
53 | |
537 | 54 syn region slimWrappedAttrValue start="[^"']" end="\s\|$" contained contains=slimAttrString,@slimRubyTop nextgroup=slimAttr,slimRuby,slimInlineTagChar |
475 | 55 syn region slimWrappedAttrValue matchgroup=slimWrappedAttrValueDelimiter start="{" end="}" contained contains=slimAttrString,@slimRubyTop nextgroup=slimAttr,slimRuby,slimInlineTagChar |
56 syn region slimWrappedAttrValue matchgroup=slimWrappedAttrValueDelimiter start="\[" end="\]" contained contains=slimAttrString,@slimRubyTop nextgroup=slimAttr,slimRuby,slimInlineTagChar | |
57 syn region slimWrappedAttrValue matchgroup=slimWrappedAttrValueDelimiter start="(" end=")" contained contains=slimAttrString,@slimRubyTop nextgroup=slimAttr,slimRuby,slimInlineTagChar | |
58 | |
59 syn region slimAttrString start=+\s*"+ skip=+\%(\\\\\)*\\"+ end=+"\s*+ contained contains=slimInterpolation,slimInterpolationEscape nextgroup=slimAttr,slimRuby,slimInlineTagChar | |
60 syn region slimAttrString start=+\s*'+ skip=+\%(\\\\\)*\\"+ end=+'\s*+ contained contains=slimInterpolation,slimInterpolationEscape nextgroup=slimAttr,slimRuby,slimInlineTagChar | |
61 | |
62 syn region slimInnerAttrString start=+\s*"+ skip=+\%(\\\\\)*\\"+ end=+"\s*+ contained contains=slimInterpolation,slimInterpolationEscape nextgroup=slimAttr | |
63 syn region slimInnerAttrString start=+\s*'+ skip=+\%(\\\\\)*\\"+ end=+'\s*+ contained contains=slimInterpolation,slimInterpolationEscape nextgroup=slimAttr | |
64 | |
65 syn region slimInterpolation matchgroup=slimInterpolationDelimiter start="#{" end="}" contains=@hamlRubyTop containedin=javascriptStringS,javascriptStringD,slimWrappedAttrs | |
508
bbcffc594d1e
Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
475
diff
changeset
|
66 syn region slimInterpolation matchgroup=slimInterpolationDelimiter start="#{{" end="}}" contains=@hamlRubyTop containedin=javascriptStringS,javascriptStringD,slimWrappedAttrs |
475 | 67 syn match slimInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)" |
68 | |
589 | 69 syn region slimPlainFilter matchgroup=slimFilter start="^\z(\s*\)\%(rdoc\|textile\|markdown\|wiki\):\s*$" end="^\%(\z1 \| *$\)\@!" |
70 syn region slimJavascriptFilter matchgroup=slimFilter start="^\z(\s*\)javascript:\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlJavaScript,slimInterpolation keepend | |
71 syn region slimCoffeeFilter matchgroup=slimFilter start="^\z(\s*\)coffee:\s*$" end="^\%(\z1 \| *$\)\@!" contains=@coffeeAll,slimInterpolation keepend | |
72 syn region slimCSSFilter matchgroup=slimFilter start="^\z(\s*\)css:\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlCss,slimInterpolation keepend | |
73 syn region slimSassFilter matchgroup=slimFilter start="^\z(\s*\)sass:\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlSassTop | |
74 | |
537 | 75 syn region slimRuby matchgroup=slimRubyOutputChar start="\s*[=]\==[']\=" skip="\%\(,\s*\|\\\)$" end="$" contained contains=@slimRubyTop keepend |
76 syn region slimRuby matchgroup=slimRubyChar start="\s*-" skip="\%\(,\s*\|\\\)$" end="$" contained contains=@slimRubyTop keepend | |
475 | 77 |
78 syn match slimComment /^\(\s*\)[/].*\(\n\1\s.*\)*/ contains=slimTodo | |
537 | 79 syn match slimText /^\(\s*\)[`|'].*\(\n\1\s.*\)*/ contains=slimInterpolation |
475 | 80 |
81 syn match slimFilter /\s*\w\+:\s*/ contained | |
82 syn match slimHaml /^\(\s*\)\<haml:\>.*\(\n\1\s.*\)*/ contains=@slimHaml,slimFilter | |
83 | |
84 syn match slimIEConditional "\%(^\s*/\)\@<=\[\s*if\>[^]]*]" contained containedin=slimComment | |
85 | |
86 hi def link slimAttrString String | |
87 hi def link slimBegin String | |
88 hi def link slimClass Type | |
508
bbcffc594d1e
Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
475
diff
changeset
|
89 hi def link slimAttr Type |
475 | 90 hi def link slimClassChar Type |
91 hi def link slimComment Comment | |
92 hi def link slimDocType Identifier | |
93 hi def link slimDocTypeKeyword Keyword | |
94 hi def link slimFilter Keyword | |
95 hi def link slimIEConditional SpecialComment | |
96 hi def link slimId Identifier | |
97 hi def link slimIdChar Identifier | |
98 hi def link slimInnerAttrString String | |
99 hi def link slimInterpolationDelimiter Delimiter | |
100 hi def link slimRubyChar Special | |
101 hi def link slimRubyOutputChar Special | |
102 hi def link slimText String | |
103 hi def link slimTodo Todo | |
104 hi def link slimWrappedAttrValueDelimiter Delimiter | |
105 hi def link slimWrappedAttrsDelimiter Delimiter | |
106 hi def link slimInlineTagChar Delimiter | |
589 | 107 hi def link slimFilter PreProc |
475 | 108 |
109 let b:current_syntax = "slim" |