Vim syntax highlighting for Blade templates (Laravel 4+).
This plugin contributes to vim-polyglot language pack.
Note: This plugin was forked from jwalton512's plugin to provide modern Laravel functionality. Massive thanks go to jwalton512 for creating and supporting this plugin for so long.
Using vim-plug vim-plug.
Plug 'alexandersix/vim-blade'
Using pathogen pathogen.vim.
cd ~/.vim/bundle
git clone git://github.com/alexandersix/vim-blade.git
Because Blade allows you to define your own directives, you can let the plugin know about them through some variables. Examples:
" Define some single Blade directives. This variable is used for highlighting only.
let g:blade_custom_directives = ['datetime', 'javascript']
" Define pairs of Blade directives. This variable is used for highlighting and indentation.
let g:blade_custom_directives_pairs = {
\ 'markdown': 'endmarkdown',
\ 'cache': 'endcache',
\ }
I've installed the plugin, but my files aren't formatting correctly!
If you have installed vim-blade
as a standalone plugin instead of as a part of the vim-polyglot
bundle, then you
may need to include the following Lua snippet in your Vim configuration somewhere that will be run on load. This
snippet sets up a group to change the filetype of Blade files to specifically "blade" when the buffer is read.
vim.cmd [[
augroup blade_settings
autocmd!
autocmd BufRead,BufNewFile *.blade.php set filetype=blade
augroup end
]]
Pull requests are greatly appreciated. Please be certain to include a test where applicable (test.blade.php
). You may test locally by using vim -u vimrc
.