jwalton512/vim-blade

Php and html indentation breaks when using html5 plugin

alx741 opened this issue · 9 comments

When editing a blade file the filetype becomes BLADE but then auto indentation for HTML and PHP (within <?php, ?> tags no longer works as spected).

Should blade indent bring in html and php indent files?

For proper html autoindent inside php files i'm using this plugin:

                  Plug 'captbaritone/better-indent-support-for-php-with-html'

@alx741 thanks for the insight.

I do seem to experience the same issue with indenting between <?php and ?>

I don't experience any issue, however, with indentation for html.

So far i notice it only preserves the indentation of the previous tag, but doesn't trigger the proper indentation levels for nested tags.

Thank your for this plugin btw, its very useful!.

Apparently vim-blade doesn't play nice with the html5 plugin, when i remove the last one, the html autoindent starts working ok in blade. I have no clue why though.

https://github.com/othree/html5.vim

@alx741 thanks for the clarity. Will try to research both items.

I too get the same error as @alx741

nivv commented

👍

My issue might not be related entirely. But I can't get indentation to work at all using blade. When using filetype=html the identation works, but of course then I don't get any sweet blade sugar.

Made a quick video.

https://www.youtube.com/watch?v=1hEaEDl3awc&feature=youtu.be

Edit: So as others have said, it works without the html5-plugin, and breaks with it enabled

nivv commented

I currently do this when re-indenting the whole blade file:

"Indent blade, <D-fi> == CMD+L | Set filetype to html, then indent, then switch back to blade 
autocmd FileType blade noremap <buffer> <D-fi> :set filetype=html<cr> gg=G'' :set filetype=blade <cr>

It works fine, it won't indent @foreach as such, it will look like below instead, which I'm fine with. Now my only annoyance is that when you insert a new line it isn't indented automatically.

image

I'm not sure why the html5-plugin is messing up this plugin. It's my understanding that the html5-plugin only extends the built in html-syntax

I'm currently trying to fix the php indentation. I came across this conditional while I was at it.

It has a syntax error (one = instead of two) so vim ignores it. When I 'fix' the syntax error, the indentation gets all messed up.

Does anyone know why it's there? Do we need it for something or should it be removed?

resolved with #51