vim-blade icon indicating copy to clipboard operation
vim-blade copied to clipboard

The syntax for blade.php files is not set automatically to "blade"

Open j4g0 opened this issue 6 years ago • 3 comments

I got vim-blade as part of sheerun/vim-polyglot which I installed via vundle on Linux Mint 18 Sarah 64 bit. The syntax works fine but I have to manually set it since vim does not seem to recognize viewname.blade.php as a blade file but as php. My airline as well as the set filetype? command say so. My workaround so far (thx to romainl) is an autocommand in my vimrc:

augroup blade autocmd! autocmd BufNewFile,BufRead *.blade.php set filetype=blade augroup END

but since no one else mentioned it as an issue so far, is was wondering where I could have screwed up during installation :)

j4g0 avatar Aug 27 '17 10:08 j4g0

I've also had this issue! I installed the package separately from polygot and my file had only php syntax highlighting - @j4g0 's solution fixed it for me however!

xp-bar avatar Sep 04 '18 20:09 xp-bar

Same problem. Simply added this line to my local .vimrc: autocmd BufRead,BufNewFile *.blade.php set filetype=blade

rku4er avatar Mar 16 '19 22:03 rku4er

Same problem. Simply added this line to my local .vimrc: autocmd BufRead,BufNewFile *.blade.php set filetype=blade

Thank you. It works well! image

benyaminl avatar Aug 17 '19 14:08 benyaminl

thanks, but not why I need to add syntax=blade for me to make it work

augroup file_blade_php
  autocmd BufRead,BufNewFile *.blade.php setlocal ts=2 sts=2 sw=2 filetype=blade syntax=blade expandtab
augroup END

rafgugi avatar Apr 02 '23 03:04 rafgugi

It shouldn't be necessary to add this configuration yourself. If the plugin was installed correctly, the ftdetect/blade.vim file will handle setting the filetype to 'blade'.

If this isn't working for you, you can debug where the filetype was last set using :verbose set ft?.

adriaanzon avatar Apr 04 '23 12:04 adriaanzon