I have another issue want to discuss.
Also html indent function.

2 issues about indent attribute only lines.

Now it is depend on the previous line have property.

    <main class="">
      <div id="abc"
           class="foo"

But some people don't write like this, but write all attributes in new line

    <main class="">
      <div 
        id="abc"
        class="foo"

This code snippet will not indent correctly. And this style is official coding 
style for the Vue web framework[1]

My approach is to check if previous line is the start line of the tag.
If yes, add one level of indent. If no, go next line.
I have a quick fix version of this approach[2].
Do you think this fix is ok?

And the second issue is some attribute don't need to have a value.
For example:

    <script async
            src="foo"

This can be solve by similar fix.


[1]:https://vuejs.org/v2/guide/components.html#Replacing-Merging-with-Existing-Attributes
[2]:https://github.com/othree/html5.vim/blob/master/indent/html.vim#L924-L929





Bram Moolenaar於 2018年3月9日星期五 UTC+8上午4時40分30秒寫道:
> Thanks, I'll include it.  And pull out the pattern into a variable, so that 
> it's obvious it's the same in several places.
> 
> 
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui