vim-polyglot/syntax/blade.vim

77 lines
3.2 KiB
VimL
Raw Normal View History

if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'blade') == -1
2016-01-22 03:08:00 -05:00
" Vim syntax file
" Language: Blade (Laravel)
2014-11-10 20:37:21 -05:00
" Maintainer: Jason Walton <jwalton512@gmail.com>
2016-01-22 03:08:00 -05:00
" Filenames: *.blade.php
2014-08-12 18:10:32 -04:00
2016-01-22 03:08:00 -05:00
if exists('b:current_syntax')
2014-08-12 18:10:32 -04:00
finish
endif
2016-01-22 03:08:00 -05:00
if !exists("main_syntax")
let main_syntax = 'blade'
endif
runtime! syntax/html.vim
unlet! b:current_syntax
2014-08-12 18:10:32 -04:00
runtime! syntax/php.vim
2016-01-22 03:08:00 -05:00
unlet! b:current_syntax
syn case match
syn clear htmlError
2016-07-05 03:53:49 -04:00
if has('patch-7.4.1142')
2016-07-19 04:09:54 -04:00
syn iskeyword @,48-57,_,192-255,@-@,:
2016-07-05 03:53:49 -04:00
else
setlocal iskeyword+=@-@
endif
2016-01-22 03:08:00 -05:00
syn region bladeEcho matchgroup=bladeDelimiter start="@\@<!{{" end="}}" contains=@bladePhp,bladePhpParenBlock containedin=ALLBUT,@bladeExempt keepend
syn region bladeEcho matchgroup=bladeDelimiter start="{!!" end="!!}" contains=@bladePhp,bladePhpParenBlock containedin=ALLBUT,@bladeExempt keepend
syn region bladeComment matchgroup=bladeDelimiter start="{{--" end="--}}" contains=bladeTodo containedin=ALLBUT,@bladeExempt keepend
2014-08-12 18:10:32 -04:00
2016-12-20 14:57:20 -05:00
syn keyword bladeKeyword @if @elseif @foreach @forelse @for @while @can @cannot @elsecan @elsecannot @include
2017-03-23 06:28:19 -04:00
\ @includeIf @each @inject @extends @section @stack @push @unless @yield @parent @hasSection @break @continue
\ @unset @lang @choice @component @slot @prepend @json @isset @auth @guest @switch @case @includeFirst @empty
2016-12-20 14:57:20 -05:00
\ nextgroup=bladePhpParenBlock skipwhite containedin=ALLBUT,@bladeExempt
syn keyword bladeKeyword @else @endif @endunless @endfor @endforeach @endforelse @endwhile @endcan
2016-12-20 14:57:20 -05:00
\ @endcannot @stop @append @endsection @endpush @show @overwrite @verbatim @endverbatim @endcomponent
\ @endslot @endprepend @endisset @endempty @endauth @endguest @endswitch
2016-12-20 14:57:20 -05:00
\ containedin=ALLBUT,@bladeExempt
2016-07-19 04:09:54 -04:00
if exists('g:blade_custom_directives')
exe "syn keyword bladeKeyword @" . join(g:blade_custom_directives, ' @') . " nextgroup=bladePhpParenBlock skipwhite containedin=ALLBUT,@bladeExempt"
endif
if exists('g:blade_custom_directives_pairs')
exe "syn keyword bladeKeyword @" . join(keys(g:blade_custom_directives_pairs), ' @') . " nextgroup=bladePhpParenBlock skipwhite containedin=ALLBUT,@bladeExempt"
exe "syn keyword bladeKeyword @" . join(values(g:blade_custom_directives_pairs), ' @') . " containedin=ALLBUT,@bladeExempt"
endif
2017-03-23 06:28:19 -04:00
syn region bladePhpRegion matchgroup=bladeKeyword start="\<@php\>\s*(\@!" end="\<@endphp\>" contains=@bladePhp containedin=ALLBUT,@bladeExempt keepend
2016-07-19 04:09:54 -04:00
syn match bladeKeyword "@php\ze\s*(" nextgroup=bladePhpParenBlock skipwhite containedin=ALLBUT,@bladeExempt
2014-08-12 18:10:32 -04:00
2016-01-22 03:08:00 -05:00
syn region bladePhpParenBlock matchgroup=bladeDelimiter start="\s*(" end=")" contains=@bladePhp,bladePhpParenBlock skipwhite contained
2014-08-12 18:10:32 -04:00
2016-01-22 03:08:00 -05:00
syn cluster bladePhp contains=@phpClTop
2016-07-19 04:09:54 -04:00
syn cluster bladeExempt contains=bladeComment,bladePhpRegion,bladePhpParenBlock,@htmlTop
2014-08-12 18:10:32 -04:00
2016-07-19 04:09:54 -04:00
syn cluster htmlPreproc add=bladeEcho,bladeComment,bladePhpRegion
2016-05-02 04:42:37 -04:00
2016-07-19 04:09:54 -04:00
syn case ignore
syn keyword bladeTodo todo fixme xxx note contained
2014-08-12 18:10:32 -04:00
2016-01-22 03:08:00 -05:00
hi def link bladeDelimiter PreProc
2014-11-10 20:37:21 -05:00
hi def link bladeComment Comment
2016-01-22 03:08:00 -05:00
hi def link bladeTodo Todo
hi def link bladeKeyword Statement
2014-08-12 18:10:32 -04:00
2016-01-22 03:08:00 -05:00
let b:current_syntax = 'blade'
2014-08-12 18:10:32 -04:00
2016-01-22 03:08:00 -05:00
if exists('main_syntax') && main_syntax == 'blade'
unlet main_syntax
2014-11-10 20:37:21 -05:00
endif
endif