New repo fix
This commit is contained in:
27
bundle/vim-blade/README.md
Normal file
27
bundle/vim-blade/README.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# vim-blade #
|
||||
|
||||
Vim syntax highlighting for Blade templates (Laravel 4+).
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Using pathogen
|
||||
[pathogen.vim](https://github.com/tpope/vim-pathogen).
|
||||
|
||||
cd ~/.vim/bundle
|
||||
git clone git://github.com/xsbeats/vim-blade.git
|
||||
|
||||
Using vundle
|
||||
[Vundle.vim](https://github.com/gmarik/Vundle.vim).
|
||||
|
||||
Plugin 'xsbeats/vim-blade'
|
||||
|
||||
Using neobundle
|
||||
[Neobundle.vim](https://github.com/Shougo/neobundle.vim)
|
||||
|
||||
NeoBundle 'xsbeats/vim-blade'
|
||||
|
||||
Todo
|
||||
----
|
||||
|
||||
Indentation (currently nonexistent)
|
||||
1
bundle/vim-blade/ftdetect/blade.vim
Normal file
1
bundle/vim-blade/ftdetect/blade.vim
Normal file
@@ -0,0 +1 @@
|
||||
au BufNewFile,BufRead *.blade.php set filetype=blade
|
||||
41
bundle/vim-blade/syntax/blade.vim
Normal file
41
bundle/vim-blade/syntax/blade.vim
Normal file
@@ -0,0 +1,41 @@
|
||||
" Language: Blade
|
||||
" Maintainer: Jason Walton <jwalton512@gmail.com>
|
||||
" URL: https://github.com/xsbeats/vim-blade
|
||||
" License: DBAD
|
||||
|
||||
" Check if our syntax is already loaded
|
||||
if exists('b:current_syntax') && b:current_syntax == 'blade'
|
||||
finish
|
||||
endif
|
||||
|
||||
" Include PHP
|
||||
runtime! syntax/php.vim
|
||||
silent! unlet b:current_syntax
|
||||
|
||||
" 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
|
||||
|
||||
" 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
|
||||
|
||||
" Comments
|
||||
syn region bladeComments start=/\s*{{--/ end=/--}}/ contains=bladeComment keepend
|
||||
syn match bladeComment /.*/ contained containedin=bladeComments
|
||||
|
||||
" Clusters
|
||||
syn cluster bladeAll contains=bladeStructure,bladeParens
|
||||
|
||||
" Highlighting
|
||||
hi def link bladeComment Comment
|
||||
hi def link bladeEchoDelim Delimiter
|
||||
hi def link bladeParen Delimiter
|
||||
hi def link bladeStructure Keyword
|
||||
|
||||
|
||||
if !exists('b:current_syntax')
|
||||
let b:current_syntax = 'blade'
|
||||
endif
|
||||
166
bundle/vim-blade/test.blade.php
Normal file
166
bundle/vim-blade/test.blade.php
Normal file
@@ -0,0 +1,166 @@
|
||||
/* Regular PHP */
|
||||
echo('foo') // shouldn't be highlighted
|
||||
<?php if ($bar->foo == $foo) return false; ?>
|
||||
|
||||
/* Regular HTML */
|
||||
<html>
|
||||
</html>
|
||||
|
||||
/* Echos */
|
||||
{!! $name !!}
|
||||
{{ $name }}
|
||||
{{{ $name }}}
|
||||
@{!! $name !!} // should be treated as regular php
|
||||
|
||||
/* Structures */
|
||||
@else
|
||||
@empty
|
||||
@endfor
|
||||
@endforeach
|
||||
@endif
|
||||
@endpush
|
||||
@endsection
|
||||
@endunless
|
||||
@endwhile
|
||||
@overwrite
|
||||
@show
|
||||
@stop
|
||||
|
||||
/* Structures (with conditions) */
|
||||
@append('foo')
|
||||
@choice('language.line', 1)
|
||||
@each(['foo', 'bar'])
|
||||
@if ($bar == ($foo*2))
|
||||
{{ $bar }}
|
||||
@elseif ($bar == ($foo*3))
|
||||
{{ $bar * 2 }}
|
||||
@else
|
||||
'foo'
|
||||
@endif
|
||||
@extends('layouts.default')
|
||||
@for($i = 0; $i < 10; $i++)
|
||||
the value is {{ $i }}
|
||||
@endforeach
|
||||
@forelse($users as $user)
|
||||
<li>{{ $user->name }}</li>
|
||||
@empty
|
||||
<p>No users</p>
|
||||
@endforelse
|
||||
@include('something')
|
||||
@lang('language.line')
|
||||
@push('foo')
|
||||
<h1>{{ $foo }}</h1>
|
||||
@endpush
|
||||
@section('nav')
|
||||
<h1>Home</h1>
|
||||
@endsection
|
||||
@stack('content')
|
||||
@unless(1 == 2)
|
||||
{{ $foo }}
|
||||
@endunless
|
||||
@while(true == false)
|
||||
{{ $foo }}
|
||||
@endwhile
|
||||
@yield('content')
|
||||
|
||||
/* Comments */
|
||||
{{-- comments on one line --}}
|
||||
{{-- comments
|
||||
on
|
||||
many
|
||||
lines --}}
|
||||
{{-- structures shouldn't escape @if($insideComments == true) --}}
|
||||
@yield('section') {{-- comments after structure are valid --}}
|
||||
{{ $comments->finished() }}
|
||||
|
||||
/* Edge Cases */
|
||||
// try a multiline include
|
||||
@include('admin.misc.sort-header', [
|
||||
'column' => 'name',
|
||||
])
|
||||
|
||||
// inside html
|
||||
<div>
|
||||
@if ($foo == $bar)
|
||||
{{ $foo }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
// keywords inside of comments
|
||||
{{--
|
||||
List from http://www.php.net/manual/en/reserved.keywords.php
|
||||
__halt_compiler()
|
||||
abstract
|
||||
and
|
||||
array()
|
||||
as
|
||||
break
|
||||
callable
|
||||
case
|
||||
catch
|
||||
class
|
||||
clone
|
||||
const
|
||||
continue
|
||||
declare
|
||||
default
|
||||
die()
|
||||
do
|
||||
echo
|
||||
else
|
||||
elseif
|
||||
empty()
|
||||
enddeclare
|
||||
endfor
|
||||
endforeach
|
||||
endif
|
||||
endswitch
|
||||
endwhile
|
||||
eval()
|
||||
exit()
|
||||
extends
|
||||
final
|
||||
finally
|
||||
for
|
||||
foreach
|
||||
function
|
||||
global
|
||||
goto
|
||||
if
|
||||
implements
|
||||
include
|
||||
include_once
|
||||
instanceof
|
||||
insteadof
|
||||
interface
|
||||
isset()
|
||||
list()
|
||||
namespace
|
||||
new
|
||||
or
|
||||
print
|
||||
private
|
||||
protected
|
||||
public
|
||||
require
|
||||
require_once
|
||||
return
|
||||
static
|
||||
switch
|
||||
throw
|
||||
trait
|
||||
try
|
||||
unset()
|
||||
use
|
||||
var
|
||||
while
|
||||
xor
|
||||
yield
|
||||
__DIR__
|
||||
__FILE__
|
||||
__FUNCTION__
|
||||
__LINE__
|
||||
__METHOD__
|
||||
__NAMESPACE__
|
||||
__TRAIT__
|
||||
--}
|
||||
Reference in New Issue
Block a user