2015-07-18 17:05:45 -04:00
|
|
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'slim') == -1
|
|
|
|
|
Add support for basic languages
coffee, cucumbeer, eruby, haml, haskell, javascript,
json, less, nginx, ocaml, ruby, sass, scss, slim,
stylus, textile, tmux
2013-09-12 10:17:03 -04:00
|
|
|
" Vim syntax file
|
|
|
|
" Language: Slim
|
|
|
|
" Maintainer: Andrew Stone <andy@stonean.com>
|
|
|
|
" Version: 1
|
|
|
|
" Last Change: 2010 Sep 25
|
|
|
|
" TODO: Feedback is welcomed.
|
|
|
|
|
|
|
|
" Quit when a syntax file is already loaded.
|
|
|
|
if exists("b:current_syntax")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
|
|
|
if !exists("main_syntax")
|
|
|
|
let main_syntax = 'slim'
|
|
|
|
endif
|
|
|
|
|
|
|
|
" Allows a per line syntax evaluation.
|
|
|
|
let b:ruby_no_expensive = 1
|
|
|
|
|
|
|
|
" Include Ruby syntax highlighting
|
|
|
|
syn include @slimRubyTop syntax/ruby.vim
|
|
|
|
unlet! b:current_syntax
|
|
|
|
" Include Haml syntax highlighting
|
|
|
|
syn include @slimHaml syntax/haml.vim
|
|
|
|
unlet! b:current_syntax
|
|
|
|
|
|
|
|
syn match slimBegin "^\s*\(&[^= ]\)\@!" nextgroup=slimTag,slimClassChar,slimIdChar,slimRuby
|
|
|
|
|
|
|
|
syn region rubyCurlyBlock start="{" end="}" contains=@slimRubyTop contained
|
|
|
|
syn cluster slimRubyTop add=rubyCurlyBlock
|
|
|
|
|
|
|
|
syn cluster slimComponent contains=slimClassChar,slimIdChar,slimWrappedAttrs,slimRuby,slimAttr,slimInlineTagChar
|
|
|
|
|
|
|
|
syn keyword slimDocType contained html 5 1.1 strict frameset mobile basic transitional
|
|
|
|
syn match slimDocTypeKeyword "^\s*\(doctype\)\s\+" nextgroup=slimDocType
|
|
|
|
|
|
|
|
syn keyword slimTodo FIXME TODO NOTE OPTIMIZE XXX contained
|
2014-01-24 12:06:22 -05:00
|
|
|
syn keyword htmlTagName contained script
|
Add support for basic languages
coffee, cucumbeer, eruby, haml, haskell, javascript,
json, less, nginx, ocaml, ruby, sass, scss, slim,
stylus, textile, tmux
2013-09-12 10:17:03 -04:00
|
|
|
|
2014-02-28 18:15:51 -05:00
|
|
|
syn match slimTag "\w\+[><]*" contained contains=htmlTagName nextgroup=@slimComponent
|
Add support for basic languages
coffee, cucumbeer, eruby, haml, haskell, javascript,
json, less, nginx, ocaml, ruby, sass, scss, slim,
stylus, textile, tmux
2013-09-12 10:17:03 -04:00
|
|
|
syn match slimIdChar "#{\@!" contained nextgroup=slimId
|
|
|
|
syn match slimId "\%(\w\|-\)\+" contained nextgroup=@slimComponent
|
|
|
|
syn match slimClassChar "\." contained nextgroup=slimClass
|
|
|
|
syn match slimClass "\%(\w\|-\)\+" contained nextgroup=@slimComponent
|
|
|
|
syn match slimInlineTagChar "\s*:\s*" contained nextgroup=slimTag,slimClassChar,slimIdChar
|
|
|
|
|
|
|
|
syn region slimWrappedAttrs matchgroup=slimWrappedAttrsDelimiter start="\s*{\s*" skip="}\s*\"" end="\s*}\s*" contained contains=slimAttr nextgroup=slimRuby
|
|
|
|
syn region slimWrappedAttrs matchgroup=slimWrappedAttrsDelimiter start="\s*\[\s*" end="\s*\]\s*" contained contains=slimAttr nextgroup=slimRuby
|
|
|
|
syn region slimWrappedAttrs matchgroup=slimWrappedAttrsDelimiter start="\s*(\s*" end="\s*)\s*" contained contains=slimAttr nextgroup=slimRuby
|
|
|
|
|
2014-07-29 07:03:49 -04:00
|
|
|
syn match slimAttr /\s*\%(\w\|-\)\+\s*=/me=e-1 contained contains=htmlArg nextgroup=slimAttrAssignment
|
Add support for basic languages
coffee, cucumbeer, eruby, haml, haskell, javascript,
json, less, nginx, ocaml, ruby, sass, scss, slim,
stylus, textile, tmux
2013-09-12 10:17:03 -04:00
|
|
|
syn match slimAttrAssignment "\s*=\s*" contained nextgroup=slimWrappedAttrValue,slimAttrString
|
|
|
|
|
2014-07-29 07:03:49 -04:00
|
|
|
syn region slimWrappedAttrValue start="[^"']" end="\s\|$" contained contains=slimAttrString,@slimRubyTop nextgroup=slimAttr,slimRuby,slimInlineTagChar
|
Add support for basic languages
coffee, cucumbeer, eruby, haml, haskell, javascript,
json, less, nginx, ocaml, ruby, sass, scss, slim,
stylus, textile, tmux
2013-09-12 10:17:03 -04:00
|
|
|
syn region slimWrappedAttrValue matchgroup=slimWrappedAttrValueDelimiter start="{" end="}" contained contains=slimAttrString,@slimRubyTop nextgroup=slimAttr,slimRuby,slimInlineTagChar
|
|
|
|
syn region slimWrappedAttrValue matchgroup=slimWrappedAttrValueDelimiter start="\[" end="\]" contained contains=slimAttrString,@slimRubyTop nextgroup=slimAttr,slimRuby,slimInlineTagChar
|
|
|
|
syn region slimWrappedAttrValue matchgroup=slimWrappedAttrValueDelimiter start="(" end=")" contained contains=slimAttrString,@slimRubyTop nextgroup=slimAttr,slimRuby,slimInlineTagChar
|
|
|
|
|
|
|
|
syn region slimAttrString start=+\s*"+ skip=+\%(\\\\\)*\\"+ end=+"\s*+ contained contains=slimInterpolation,slimInterpolationEscape nextgroup=slimAttr,slimRuby,slimInlineTagChar
|
|
|
|
syn region slimAttrString start=+\s*'+ skip=+\%(\\\\\)*\\"+ end=+'\s*+ contained contains=slimInterpolation,slimInterpolationEscape nextgroup=slimAttr,slimRuby,slimInlineTagChar
|
|
|
|
|
|
|
|
syn region slimInnerAttrString start=+\s*"+ skip=+\%(\\\\\)*\\"+ end=+"\s*+ contained contains=slimInterpolation,slimInterpolationEscape nextgroup=slimAttr
|
|
|
|
syn region slimInnerAttrString start=+\s*'+ skip=+\%(\\\\\)*\\"+ end=+'\s*+ contained contains=slimInterpolation,slimInterpolationEscape nextgroup=slimAttr
|
|
|
|
|
|
|
|
syn region slimInterpolation matchgroup=slimInterpolationDelimiter start="#{" end="}" contains=@hamlRubyTop containedin=javascriptStringS,javascriptStringD,slimWrappedAttrs
|
2014-01-09 05:59:09 -05:00
|
|
|
syn region slimInterpolation matchgroup=slimInterpolationDelimiter start="#{{" end="}}" contains=@hamlRubyTop containedin=javascriptStringS,javascriptStringD,slimWrappedAttrs
|
Add support for basic languages
coffee, cucumbeer, eruby, haml, haskell, javascript,
json, less, nginx, ocaml, ruby, sass, scss, slim,
stylus, textile, tmux
2013-09-12 10:17:03 -04:00
|
|
|
syn match slimInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
|
|
|
|
|
2014-07-29 07:03:49 -04:00
|
|
|
syn region slimRuby matchgroup=slimRubyOutputChar start="\s*[=]\==[']\=" skip="\%\(,\s*\|\\\)$" end="$" contained contains=@slimRubyTop keepend
|
|
|
|
syn region slimRuby matchgroup=slimRubyChar start="\s*-" skip="\%\(,\s*\|\\\)$" end="$" contained contains=@slimRubyTop keepend
|
Add support for basic languages
coffee, cucumbeer, eruby, haml, haskell, javascript,
json, less, nginx, ocaml, ruby, sass, scss, slim,
stylus, textile, tmux
2013-09-12 10:17:03 -04:00
|
|
|
|
|
|
|
syn match slimComment /^\(\s*\)[/].*\(\n\1\s.*\)*/ contains=slimTodo
|
2014-07-29 07:03:49 -04:00
|
|
|
syn match slimText /^\(\s*\)[`|'].*\(\n\1\s.*\)*/ contains=slimInterpolation
|
Add support for basic languages
coffee, cucumbeer, eruby, haml, haskell, javascript,
json, less, nginx, ocaml, ruby, sass, scss, slim,
stylus, textile, tmux
2013-09-12 10:17:03 -04:00
|
|
|
|
|
|
|
syn match slimFilter /\s*\w\+:\s*/ contained
|
|
|
|
syn match slimHaml /^\(\s*\)\<haml:\>.*\(\n\1\s.*\)*/ contains=@slimHaml,slimFilter
|
|
|
|
|
|
|
|
syn match slimIEConditional "\%(^\s*/\)\@<=\[\s*if\>[^]]*]" contained containedin=slimComment
|
|
|
|
|
|
|
|
hi def link slimAttrString String
|
|
|
|
hi def link slimBegin String
|
|
|
|
hi def link slimClass Type
|
2014-02-28 18:15:51 -05:00
|
|
|
hi def link slimAttr Type
|
Add support for basic languages
coffee, cucumbeer, eruby, haml, haskell, javascript,
json, less, nginx, ocaml, ruby, sass, scss, slim,
stylus, textile, tmux
2013-09-12 10:17:03 -04:00
|
|
|
hi def link slimClassChar Type
|
|
|
|
hi def link slimComment Comment
|
|
|
|
hi def link slimDocType Identifier
|
|
|
|
hi def link slimDocTypeKeyword Keyword
|
|
|
|
hi def link slimFilter Keyword
|
|
|
|
hi def link slimIEConditional SpecialComment
|
|
|
|
hi def link slimId Identifier
|
|
|
|
hi def link slimIdChar Identifier
|
|
|
|
hi def link slimInnerAttrString String
|
|
|
|
hi def link slimInterpolationDelimiter Delimiter
|
|
|
|
hi def link slimRubyChar Special
|
|
|
|
hi def link slimRubyOutputChar Special
|
|
|
|
hi def link slimText String
|
|
|
|
hi def link slimTodo Todo
|
|
|
|
hi def link slimWrappedAttrValueDelimiter Delimiter
|
|
|
|
hi def link slimWrappedAttrsDelimiter Delimiter
|
|
|
|
hi def link slimInlineTagChar Delimiter
|
|
|
|
|
|
|
|
let b:current_syntax = "slim"
|
2015-07-18 17:05:45 -04:00
|
|
|
|
|
|
|
endif
|