HTML indent script sucks

264 views
Skip to first unread message

Andy Wokula

unread,
Aug 4, 2013, 3:53:39 PM8/4/13
to vim...@googlegroups.com
People, you can fill this thread with your complaints about the HTML
indent script.

I'm the current maintainer, lately I read lots of unspecific rants here and
there but direct feedback is rare for some reason.

The current version is a descendant of
http://vim.sf.net/scripts/script.php?script_id=2075
It's very different from the original version by J. Zellner.

I'm aware of some deficiencies, I don't mind to hear them twice.

--
Andy

Ben Fritz

unread,
Aug 4, 2013, 4:21:03 PM8/4/13
to vim...@googlegroups.com, anw...@yahoo.de
On Sunday, August 4, 2013 2:53:39 PM UTC-5, Andy Wokula wrote:
>
>
> The current version is a descendant of
>
> http://vim.sf.net/scripts/script.php?script_id=2075
>
> It's very different from the original version by J. Zellner.
>

How long ago did "the original version" get replaced with yours? Perhaps most complaints pre-date you taking over.

tooth pik

unread,
Aug 4, 2013, 5:32:00 PM8/4/13
to vim...@googlegroups.com
On Sun, Aug 04, 2013 at 09:53:39PM +0200, Andy Wokula wrote:
> People, you can fill this thread with your complaints about the HTML
> indent script.

> I'm the current maintainer, lately I read lots of unspecific rants here and
> there but direct feedback is rare for some reason.

> The current version is a descendant of

> http://vim.sf.net/scripts/script.php?script_id=2075

interestingly, what's available on vim.sourceforge.net is version 0.8,
and what's being disseminated with the runtime is version 0.9

I thought what's on sf.net was supposed to be more current, not less

--
_|_ _ __|_|_ ._ o|
|_(_)(_)|_| ||_)||<
|

Tony Mechelynck

unread,
Aug 4, 2013, 9:20:59 PM8/4/13
to vim...@googlegroups.com
Ben, about 6 hours before you posted this, and in a different thread
("Official petition" etc., which is totally unofficial and a one-man
petition so far) Bram wrote "Editing HTML is a pain. I hope someone
fixes the indent plugin for that." Admittedly he didn't give any details.

Me, I use ":filetype indent off" on coming back from sourcing the
vimrc_example.vim, so even though I do quite a lot of HTML editing I
have no opinion about the quality of its indent plugin.


Best regards,
Tony.
--
Welcome to Burger God: Have it YAHWEH!

Gary Johnson

unread,
Aug 5, 2013, 3:01:48 AM8/5/13
to vim...@googlegroups.com
Thank you for being so open to criticism and so willing to make
changes.

I started looking for examples of indentation that I didn't like in
my HTML files. Then I looked in the indent/html.vim plugin and
discovered that it had changed a lot since the last time I tried
tuning it. I found that I could fix all the indentation issues by
putting this in my ~/.vimrc:

let g:html_indent_inctags = "body,html,head,p,tbody"

With that, the indentation now looks great.

I got frustrated with Vim's HTML indentation some time ago and just
stopped relying on it. It may be that I haven't given it a chance
since your plugin was adopted.

Regards,
Gary

Andy Wokula

unread,
Aug 5, 2013, 2:31:25 PM8/5/13
to vim...@googlegroups.com
Am 05.08.2013 09:01, schrieb Gary Johnson:
> On 2013-08-04, Andy Wokula wrote:
>> People, you can fill this thread with your complaints about the HTML
>> indent script.
>>
>> I'm the current maintainer, lately I read lots of unspecific rants
>> here and there but direct feedback is rare for some reason.
>>
>> The current version is a descendant of
>> http://vim.sf.net/scripts/script.php?script_id=2075
>> It's very different from the original version by J. Zellner.
>>
>> I'm aware of some deficiencies, I don't mind to hear them twice.
>
> Thank you for being so open to criticism and so willing to make
> changes.
>
> I started looking for examples of indentation that I didn't like in
> my HTML files. Then I looked in the indent/html.vim plugin and
> discovered that it had changed a lot since the last time I tried
> tuning it. I found that I could fix all the indentation issues by
> putting this in my ~/.vimrc:
>
> let g:html_indent_inctags = "body,html,head,p,tbody"
>
> With that, the indentation now looks great.

Ok. If it works, this means you are always putting the closing tag.
But the end tag for BODY, HTML, P, TBODY (and a few others) is optional.
I want to add support for missing closing tags, but I wonder if it's
worth the effort.

And yes, you can tell for each tag element if it should cause extra
indent or not.

> I got frustrated with Vim's HTML indentation some time ago and just
> stopped relying on it. It may be that I haven't given it a chance
> since your plugin was adopted.

--
Andy

Andy Wokula

unread,
Aug 5, 2013, 2:39:00 PM8/5/13
to vim...@googlegroups.com
The new script is included since June 12 2013.

--
Andy

Gary Johnson

unread,
Aug 5, 2013, 2:54:48 PM8/5/13
to vim...@googlegroups.com
On 2013-08-05, Andy Wokula wrote:
> Am 05.08.2013 09:01, schrieb Gary Johnson:

> >I started looking for examples of indentation that I didn't like in
> >my HTML files. Then I looked in the indent/html.vim plugin and
> >discovered that it had changed a lot since the last time I tried
> >tuning it. I found that I could fix all the indentation issues by
> >putting this in my ~/.vimrc:
> >
> > let g:html_indent_inctags = "body,html,head,p,tbody"
> >
> >With that, the indentation now looks great.
>
> Ok. If it works, this means you are always putting the closing tag.
> But the end tag for BODY, HTML, P, TBODY (and a few others) is optional.
> I want to add support for missing closing tags, but I wonder if it's
> worth the effort.

I always use the end tag for BODY, HTML and TBODY, but I only
sometimes use the end tag for P. That did cause an indentation
problem for some of my paragraphs when using your plugin, but I
decided that now, some years after writing those files, I prefer
using the end tag for P as well. It's not that much effort and it
just looks cleaner.

I did look in your plugin for a way to make the </P> tag optional.
I suppose that would be nice, but it's no longer an issue for me.

Regards,
Gary

Ingo Karkat

unread,
Aug 7, 2013, 12:28:30 PM8/7/13
to vim...@googlegroups.com
On 04-Aug-2013 21:53 +0200, Andy Wokula wrote:

> People, you can fill this thread with your complaints about the HTML
> indent script.
>
> I'm the current maintainer, lately I read lots of unspecific rants here and
> there but direct feedback is rare for some reason.

First of all: Thank you for continuing the maintenance of this important
filetype. I've quickly tried it, and at least it's not worse than the
previous one ;-)

> The current version is a descendant of
> http://vim.sf.net/scripts/script.php?script_id=2075
> It's very different from the original version by J. Zellner.
>
> I'm aware of some deficiencies, I don't mind to hear them twice.

My first complaint is not directed against you:

> The new script is included since June 12 2013.

Because Bram doesn't send out runtime updates as patches, nor are the
changes appropriately reflected in the Mercurial commit messages, this
makes it hard to follow. Especially unfortunate in this case because of
the interface change (i.e. what used to be g:html_indent_tags is now
g:html_indent_inctags with different value syntax). IMO changes like
this should be announced more prominently, at least by a separate commit
with a good summary message.


But to your new indent plugin:

1. As there are many dialects / extensions of HTML (e.g. the various
templating languages like JSP, GSP), the script is probably used for
other filetypes, too, with a changed set of tags. The current global
variables make it cumbersome to re-use the script: Save current global
vars, adapt it, runtime! indent/html.vim, restore global vars.

2. I had used the old script for Groovy Server Pages and configured
indenting for all various Groovy tags matching g:\S\+; unfortunately,
your script only supports literal tag names so far (enumerating all the
different tag libraries is close to impossible, but they all have the g:
prefix). Fortunately, your script uses \w\+ (which is too simple, see
the HTML standard, but I'd prefer you'd adhere to the XML standard,
including namespaces) to extract the tag names, so I can right now get
away with just defining a "g" tag.

3. Likewise, there are many self-closing <g:foo/> tags. I know it's not
part of HTML syntax, but your script probably should ignore (i.e. not
indent) those.

4. In HTML, I like to return to column 1 after a <pre>. This is trivial
to patch:

#v+
@@ -350,7 +350,7 @@ func! s:FreshState(lnum) "{{{

func! s:Alien2() "{{{
" <pre> block
- return -1
+ return 0
endfunc "}}}
func! s:Alien3() "{{{
" <script> javascript
#v-
but I'd love to have this configurable.


Thanks for being so open to feedback and willing to improve on this
crucial piece of infrastructure!

-- regards, ingo

Will Gray (graywh)

unread,
Sep 4, 2013, 3:54:59 PM9/4/13
to vim...@googlegroups.com, anw...@yahoo.de
The new HTML indent script breaks Eruby indenting.

https://github.com/vim-ruby/vim-ruby/issues/170

Reply all
Reply to author
Forward
0 new messages