diff --git a/build b/build index 7e0ff19..a4c29b3 100755 --- a/build +++ b/build @@ -77,6 +77,7 @@ PACKS=" dockerfile:honza/dockerfile.vim elixir:elixir-lang/vim-elixir emberscript:heartsentwined/vim-ember-script + emblem:heartsentwined/vim-emblem erlang:oscarh/vimerl git:tpope/vim-git go:jnwhiteh/vim-golang diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 17dad43..0cdbebc 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -17,6 +17,8 @@ au BufRead,BufNewFile *.ex,*.exs set filetype=elixir au FileType elixir setl sw=2 sts=2 et iskeyword+=!,? autocmd BufNewFile,BufRead *.em set filetype=ember-script autocmd FileType ember-script set tabstop=2|set shiftwidth=2|set expandtab +autocmd BufNewFile,BufRead *.emblem set filetype=emblem +autocmd FileType emblem set tabstop=2|set shiftwidth=2|set expandtab autocmd BufNewFile,BufRead *.git/{,modules/**/}{COMMIT_EDIT,TAG_EDIT,MERGE_,}MSG set ft=gitcommit autocmd BufNewFile,BufRead *.git/config,.gitconfig,.gitmodules set ft=gitconfig autocmd BufNewFile,BufRead */.config/git/config set ft=gitconfig diff --git a/ftplugin/emblem.vim b/ftplugin/emblem.vim new file mode 100644 index 0000000..68b7f25 --- /dev/null +++ b/ftplugin/emblem.vim @@ -0,0 +1,17 @@ +" Language: emblem +" Maintainer: heartsentwined +" URL: http://github.com/heartsentwined/vim-emblem +" Version: 1.2.0 +" Last Change: 2013 Apr 22 +" License: GPL-3.0 + +setlocal tabstop=2 +setlocal softtabstop=2 +setlocal shiftwidth=2 +setlocal smarttab +setlocal expandtab +setlocal smartindent + +setlocal formatoptions=q +setlocal comments=:/ +setlocal commentstring=/\ %s diff --git a/indent/emblem.vim b/indent/emblem.vim new file mode 100644 index 0000000..21c8aea --- /dev/null +++ b/indent/emblem.vim @@ -0,0 +1,6 @@ +" Language: emblem +" Maintainer: heartsentwined +" URL: http://github.com/heartsentwined/vim-emblem +" Version: 1.2.0 +" Last Change: 2013 Apr 22 +" License: GPL-3.0 diff --git a/syntax/emblem.vim b/syntax/emblem.vim new file mode 100644 index 0000000..b5807c7 --- /dev/null +++ b/syntax/emblem.vim @@ -0,0 +1,156 @@ +" Language: emblem +" Maintainer: heartsentwined +" URL: http://github.com/heartsentwined/vim-emblem +" Version: 1.2.0 +" Last Change: 2013 Apr 22 +" License: GPL-3.0 + +" Quit when a syntax file is already loaded. +if exists('b:current_syntax') && b:current_syntax == 'emblem' + finish +endif + +if !exists('main_syntax') + let main_syntax = 'emblem' +endif + +syn match eblLineStart '^\s*' nextgroup=@eblStartElements display +syn match eblLineOp '\s*:' nextgroup=@eblStartElements skipwhite contained display +hi def link eblLineOp eblOperator + +syn cluster eblStartElements contains=eblIdOp,eblClassOp,eblHbsOp,@eblHbsHelpers,eblHbsPartialOp,eblView,@eblTag,eblComment,eblText + +syn cluster eblComponent contains=eblIdOp,eblClassOp,eblInlineText,eblAttr,eblHbsOp,eblHbsAttrRegion,eblHbsPartialOp,eblLineOp + +syn match eblIdOp '#' nextgroup=eblId contained display +syn match eblId '\v(\w|-)+' nextgroup=@eblComponent contained display +syn match eblClassOp '\.' nextgroup=eblClass contained display +syn match eblClass '\v(\w|-)+' nextgroup=@eblComponent contained display +hi def link eblIdOp eblId +hi def link eblClassOp eblClass + +syn region eblHbsAttrRegion matchgroup=eblHbsAttrRegionOp start='{' end='}' contains=@eblHbsHelpers nextgroup=@eblComponent keepend contained display +hi def link eblHbsAttrRegionOp eblOperator + +syn match eblInlineText '\v\s+[^:]+.*$' contains=eblItpl contained display +hi def link eblInlineText eblRaw + +syn cluster eblHbsComponent contains=eblHbsArg,eblHbsAttr,eblHbsTextOp,eblLineOp + +syn match eblHbsOp '\v\s*\=+' nextgroup=@eblHbsHelpers skipwhite contained display +syn match eblHbsHelper '\v\w(\w|-|\.)*' nextgroup=@eblHbsComponent skipwhite contained display +syn match eblHbsTextOp '|' nextgroup=eblHbsText contained display +syn match eblHbsText '.*' contained display +hi def link eblHbsOp eblOperator +hi def link eblHbsHelper eblFunction +hi def link eblHbsTextOp eblOperator +hi def link eblHbsText eblRaw + +syn cluster eblHbsHelpers contains=eblHbsHelper,eblHbsCtrlFlowHelper,eblHbsEachHelper + +syn match eblHbsCtrlFlowHelper '\v<(if|unless|else|with)>' nextgroup=@eblHbsComponent skipwhite contained display +syn match eblHbsEachHelper '\v' nextgroup=eblHbsEachArg skipwhite contained display +syn match eblHbsEachArg /\v((["'])[^\2]{-}\2|(\w|\.|-|\>)+)/ nextgroup=eblHbsIn,eblLineOp skipwhite contained display +syn match eblHbsIn '\v' nextgroup=eblHbsInArg skipwhite contained display +syn match eblHbsInArg /\v((["'])[^\2]{-}\2|(\w|\.|-|\>)+)/ nextgroup=eblLineOp skipwhite contained display +hi def link eblHbsCtrlFlowHelper eblKeyword +hi def link eblHbsEachHelper eblKeyword +hi def link eblHbsEachArg eblLiteral +hi def link eblHbsIn eblKeyword +hi def link eblHbsInArg eblLiteral + +syn match eblHbsArg /\v\s*((["'])[^\2]{-}\2|(\w|\.|-|\>)+)/ nextgroup=@eblHbsComponent skipwhite contained display +syn match eblHbsAttr '\v\s*(\w|-)+\=@=' contains=eblHbsAttrBind nextgroup=eblHbsAttrOp contained display +syn match eblHbsAttrBind /\v<(\w|-)+Bind>/ contained display +syn match eblHbsAttrOp '=' nextgroup=eblHbsAttrLit contained display +syn match eblHbsAttrLit /\v(["'])[^\1]{-}\1|[^: ]+/ contains=eblItpl nextgroup=@eblHbsComponent skipwhite contained display +hi def link eblHbsArg eblLiteral +hi def link eblHbsAttr eblAttr +hi def link eblhbsAttrBind eblBind +hi def link eblHbsAttrOp eblOperator +hi def link eblHbsAttrLit eblLiteral + +syn cluster eblAttrComponent contains=eblAttr,eblInlineText,eblLineOp + +syn match eblAttr '\v\s*(\w|-)+\=@=' contains=eblKnownEvent nextgroup=eblAttrOp contained display +syn match eblAttrOp '=' nextgroup=eblAttrLit,eblAttrClassLit,eblAttrBind,eblAttrRegion contained display +syn match eblAttrLit /\v(["'])[^\1]{-}\1/ contains=eblItpl nextgroup=@eblAttrComponent skipwhite contained display +syn match eblAttrBind /\v(\w|-)+/ nextgroup=eblAttrBindAltOp,eblAttrBindUnboundOp,@eblAttrComponent skipwhite contained display +syn match eblAttrBindAltOp '\v(\w|-|:)@=:(\w|-|:)@=' nextgroup=eblAttrBindAlt,eblAttrBindAltOp contained display +syn match eblAttrBindAlt /\v(\w|-)+/ nextgroup=eblAttrBindAltOp,@eblAttrComponent skipwhite contained display +syn match eblAttrClassLit '\v:(\w|-)+' nextgroup=@eblAttrComponent skipwhite contained display +syn match eblAttrBindUnboundOp '\v(\w|-)@!!' nextgroup=@eblAttrComponent skipwhite contained display +hi def link eblAttrOp eblOperator +hi def link eblAttrLit eblLiteral +hi def link eblAttrBind eblBind +hi def link eblAttrBindAltOp eblOperator +hi def link eblAttrBindAlt eblBool +hi def link eblAttrClassLit eblLiteral +hi def link eblAttrBindUnboundOp eblOperator + +syn region eblAttrRegion matchgroup=eblAttrRegionOp start='{' end='}' keepend contains=eblAttrRegionBind,eblAttrRegionClassLit nextgroup=@eblAttrComponent skipwhite contained display +syn match eblAttrRegionBind /\v(\w|-)+/ nextgroup=eblAttrRegionBindAltOp contained display +syn match eblAttrRegionBindAltOp '\v(\w|-|:)@=:(\w|-|:)@=' nextgroup=eblAttrRegionBindAlt,eblAttrRegionBindAltOp contained display +syn match eblAttrRegionBindAlt /\v(\w|-)+/ nextgroup=eblAttrRegionBindAltOp contained display +syn match eblAttrRegionClassLit '\v:(\w|-)+:@!' nextgroup=eblAttrRegionBind skipwhite contained display +hi def link eblAttrRegionOp eblOperator +hi def link eblAttrRegionBind eblBind +hi def link eblAttrRegionBindAltOp eblOperator +hi def link eblAttrRegionBindAlt eblBool +hi def link eblAttrRegionClassLit eblLiteral + +syn match eblKnownEvent '\v\s*<(touchStart|touchMove|touchEnd|touchCancel|keyDown|keyUp|keyPress|mouseDown|mouseUp|contextMenu|click|doubleClick|mouseMove|focusIn|focusOut|mouseEnter|mouseLeave|submit|input|change|dragStart|drag|dragEnter|dragLeave|dragOver|drop|dragEnd)>' contained display +hi def link eblKnownEvent eblEvent + +syn region eblItpl matchgroup=eblItplOp start='#{' end='}' contains=@eblHbsHelpers,eblHbsPartialOp keepend contained display +syn region eblItpl matchgroup=eblItplOp start='{{' end='}}' contains=@eblHbsHelpers,eblHbsPartialOp keepend contained display +hi def link eblItplOp eblOperator + +syn match eblHbsPartialOp '\s*>' nextgroup=@eblHbsHelpers skipwhite contained display +hi def link eblhbsPartialOp eblOperator + +syn match eblView '\v[A-Z](\w|\.)*' nextgroup=@eblViewComponent skipwhite contained display + +syn cluster eblViewComponent contains=eblViewIdOp,eblViewClassOp,eblHbsArg,eblHbsAttr,eblLineOp + +syn match eblViewIdOp '#' nextgroup=eblViewId contained display +syn match eblViewId '\v(\w|-)+' nextgroup=@eblViewComponent contained display +syn match eblViewClassOp '\.' nextgroup=eblViewClass contained display +syn match eblViewClass '\v(\w|-)+' nextgroup=@eblViewComponent contained display +hi def link eblViewIdOp eblId +hi def link eblViewId eblId +hi def link eblViewClassOp eblClass +hi def link eblViewClass eblClass + +syn cluster eblTag contains=eblKnownTag,eblCustomTag + +syn match eblKnownTag '\v<(figcaption|blockquote|plaintext|textarea|progress|optgroup|noscript|noframes|frameset|fieldset|datalist|colgroup|basefont|summary|section|marquee|listing|isindex|details|command|caption|bgsound|article|address|acronym|strong|strike|spacer|source|select|script|output|option|object|legend|keygen|iframe|hgroup|header|footer|figure|center|canvas|button|applet|video|track|title|thead|tfoot|tbody|table|style|small|param|meter|label|input|frame|embed|blink|audio|aside|time|span|samp|ruby|nobr|meta|menu|mark|main|link|html|head|form|font|data|code|cite|body|base|area|abbr|xmp|wbr|var|sup|sub|pre|nav|map|kbd|ins|img|div|dir|dfn|del|col|big|bdo|bdi|ul|tt|tr|th|td|rt|rp|ol|li|hr|h6|h5|h4|h3|h2|h1|em|dt|dl|dd|br|u|s|q|p|i|b|a)>' nextgroup=@eblComponent contained display +syn match eblCustomTag '%[a-z][a-z0-9-]*' nextgroup=@eblComponent contained display +hi def link eblKnownTag eblTag +hi def link eblCustomTag eblTag + +syn match eblTextOp '\v^(\s*)[|']' contained display +syn region eblText start='\v^\z(\s*)[|']' end='\v^(\z1 )@!' contains=eblTextOp,eblItpl +syn region eblComment start='\v^\z(\s*)/' end='\v^(\z1 )@!' +hi def link eblText eblRaw +hi def link eblTextOp eblOperator + + +hi def link eblOperator Operator +hi def link eblFunction Function +hi def link eblBool Boolean +hi def link eblLiteral String +hi def link eblRaw NONE +hi def link eblComment Comment + +hi def link eblAttr Label +hi def link eblBind Identifier +hi def link eblKeyword Keyword +hi def link eblEvent Special + +hi def link eblView Type +hi def link eblTag Type +hi def link eblId Constant +hi def link eblClass Identifier + +let b:current_syntax = 'emblem'