vim-polyglot/syntax/blade.vim

46 lines
1.8 KiB
VimL
Raw Normal View History

if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'blade') == -1
2014-11-10 20:37:21 -05:00
" Language: Blade
" Maintainer: Jason Walton <jwalton512@gmail.com>
" URL: https://github.com/xsbeats/vim-blade
" License: DBAD
2014-08-12 18:10:32 -04:00
2014-11-10 20:37:21 -05:00
" Check if our syntax is already loaded
if exists('b:current_syntax') && b:current_syntax == 'blade'
2014-08-12 18:10:32 -04:00
finish
endif
2014-11-10 20:37:21 -05:00
" Include PHP
2014-08-12 18:10:32 -04:00
runtime! syntax/php.vim
2014-11-10 20:37:21 -05:00
silent! unlet b:current_syntax
2014-08-12 18:10:32 -04:00
2014-11-10 20:37:21 -05:00
" Echos
syn region bladeUnescapedEcho matchgroup=bladeEchoDelim start=/@\@<!\s*{!!/ end=/!!}\s*/ oneline contains=@phpClTop containedin=ALLBUT,bladeComment
syn region bladeEscapedEcho matchgroup=bladeEchoDelim start=/@\@<!\s*{{{\@!/ end=/}}\s*/ oneline contains=@phpClTop containedin=ALLBUT,bladeComment
syn region bladeEscapedEcho matchgroup=bladeEchoDelim start=/@\@<!\s*{{{{\@!/ end=/}}}/ oneline contains=@phpClTop containedin=ALLBUT,bladeComment
2014-08-12 18:10:32 -04:00
2014-11-10 20:37:21 -05:00
" Structures
syn match bladeStructure /\s*@\(else\|empty\|endfor\|endforeach\|endforelse\|endif\|endpush\|endsection\|endunless\|endwhile\|overwrite\|show\|stop\)\>/
syn match bladeStructure /\s*@\(append\|choice\|each\|elseif\|extends\|for\|foreach\|forelse\|if\|include\|lang\|push\|section\|stack\|unless\|while\|yield\|\)\>\s*/ nextgroup=bladeParens
syn region bladeParens matchgroup=bladeParen start=/(/ end=/)/ contained contains=@bladeAll,@phpClTop
2014-08-12 18:10:32 -04:00
2014-11-10 20:37:21 -05:00
" Comments
syn region bladeComments start=/\s*{{--/ end=/--}}/ contains=bladeComment keepend
syn match bladeComment /.*/ contained containedin=bladeComments
2014-08-12 18:10:32 -04:00
2014-11-10 20:37:21 -05:00
" Clusters
syn cluster bladeAll contains=bladeStructure,bladeParens
2014-08-12 18:10:32 -04:00
2014-11-10 20:37:21 -05:00
" Highlighting
hi def link bladeComment Comment
hi def link bladeEchoDelim Delimiter
hi def link bladeParen Delimiter
hi def link bladeStructure Keyword
2014-08-12 18:10:32 -04:00
2014-11-10 20:37:21 -05:00
if !exists('b:current_syntax')
let b:current_syntax = 'blade'
endif
endif