jwalton512 / vim-blade

Vim syntax highlighting for Blade templates.
226 stars 37 forks source link

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

Closed j4g0 closed 1 year ago

j4g0 commented 7 years ago

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 :)

xp-bar commented 6 years ago

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!

rku4er commented 5 years ago

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

benyaminl commented 5 years ago

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

Thank you. It works well! image

rafgugi commented 1 year ago

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
adriaanzon commented 1 year ago

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?.