laravelvimnerdcommenter

VIM comment out on blade files


How can I toggle comments on blade.php extension files.

Blade is a Laravel specific file which uses {{-- --}} to comment out.

I installed Nerdcommenter but, don't know how to modify it to work with blade files due to the lack of Vim knowledge

Now, when I comment out the plugin uses

<!-- -->

Does anyone know how to set the thing up or recommend me other plugins?


Solution

  • nerdcommenter already have the comment style you mention, but you need to be using the filetype laravel for it to work properly.

    Try issuing :set ft=laravel before using nerdcommenter again.

    To make this work everytime you edit a blade file, you can include the following line in your vimrc:

    autocmd BufRead,BufNewFile *.blade.php set filetype=laravel
    

    You probably also need to ensure that you have filetype indent plugin on in your vimrc.