changeset 538:f5b6dba3308b

Add syntax highlight for blade (laravel).
author edogawaconan <me@myconan.net>
date Mon, 05 Jan 2015 21:49:47 +0900
parents 351bd965bc1f
children 05785a85d603
files rc/vimrc update-vim-syntax vendor/vim-syntax/blade.vim
diffstat 3 files changed, 43 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rc/vimrc	Mon Jan 05 21:47:44 2015 +0900
+++ b/rc/vimrc	Mon Jan 05 21:49:47 2015 +0900
@@ -93,6 +93,7 @@
   autocmd BufRead,BufNewFile *.erb :set ft=eruby
   autocmd BufRead,BufNewFile *.scss :set ft=scss
   autocmd BufRead,BufNewFile *.slim :set ft=slim
+  autocmd BufRead,BufNewFile *.blade.php :set ft=blade
 endif
 
 if has('autocmd')
--- a/update-vim-syntax	Mon Jan 05 21:47:44 2015 +0900
+++ b/update-vim-syntax	Mon Jan 05 21:49:47 2015 +0900
@@ -18,3 +18,4 @@
 _get https://github.com/kchmck/vim-coffee-script/raw/master/syntax/coffee.vim
 _get https://github.com/slim-template/vim-slim/raw/master/syntax/slim.vim
 _get https://github.com/elzr/vim-json/raw/master/syntax/json.vim
+_get https://raw.githubusercontent.com/xsbeats/vim-blade/master/syntax/blade.vim
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/vim-syntax/blade.vim	Mon Jan 05 21:49:47 2015 +0900
@@ -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