jwalton512 / vim-blade

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

Auto indent issue #1

Closed elclanrs closed 10 years ago

elclanrs commented 11 years ago

Trying to use this plugin to develop in Laravel. Syntax looks nice, but the indentation doesn't seem to work properly. Given this sample code below, when I press o at the cursor # the new line | starts at the very beginning not at the proper indentation level.

@foreach ($articles as $article)
   <h1>{{ $article->title }}</h1>
   <p>{{ $article->content }}</p>#
|
@endforeach

When it should be:

@foreach ($articles as $article)
   <h1>{{ $article->title }}</h1>
   <p>{{ $article->content }}</p>#
   |
@endforeach

This happens at any indentation level. Any ideas how to fix it?

elclanrs commented 11 years ago

Playing around just found a "fix", if I open a blade file file.blade.php and try the above it doesn't work, but if I run :set ft=html and then :set ft=blade it works fine. I guess the default is php syntax, known not to work very well with HTML in Vim... I would live without the PHP syntax but haven't found a way to disable it by default...

elclanrs commented 11 years ago

Got a permanent fix, at least for now, this works for Blade, PHP and HTML syntax with correct autoindent:

autocmd BufNewFile,BufRead *.blade.php set ft=html | set ft=phtml | set ft=blade " Fix blade auto-indent
nullcitizen commented 11 years ago

@elclanrs worked for me, I modified my blade.vim with the above autocmd and everything seems to be working fine. If no new issue comes up mayhaps a pull request is in order?

asethwright commented 11 years ago

@elclanrs thanks, also worked for me.

baycak commented 7 years ago

@elclanrs thanks bro, it also worked for me.

kevariable commented 4 years ago

Got a permanent fix, at least for now, this works for Blade, PHP and HTML syntax with correct autoindent:

autocmd BufNewFile,BufRead *.blade.php set ft=html | set ft=phtml | set ft=blade " Fix blade auto-indent

after putting this configuration, my blade can't use emmed why?