janus icon indicating copy to clipboard operation
janus copied to clipboard

Some html elements don't indent

Open sdhull opened this issue 13 years ago • 9 comments

It's a minor issue, but has been bothering me for awhile.

After an auto-format, I've found that both <li> and <p> elements don't get indented. That is:

<li>
<a>Not indented</a>
</li>

One thing I haven't got the faintest idea of how to do in vim is customize syntax indentations. Could someone help me a bit with this please?

sdhull avatar Jan 06 '13 01:01 sdhull

Check this out, please let me know the best fix for you maybe we will include it as an option in janus.

kalbasit avatar Jan 20 '13 06:01 kalbasit

@eMxyzptlk thanks for the link! Unfortunately neither of the answers worked for me. :(

Any other suggestions would be greatly appreciated.

sdhull avatar Jan 22 '13 19:01 sdhull

Are you sure? let g:html_indent_tags = 'p\|li\|nav' this worked for me. I will reopen for now because that one worked great except it over-wrote the initial value and other HTML tags are no longer indented so I should try to find a new fix myself

kalbasit avatar Jan 24 '13 08:01 kalbasit

Let me try again, but last time I tried it, it didn't help. I had just updated Janus and verified that the setting had stuck by doing let g:html_indent_tags and it showed 'p\|li\|nav'

sdhull avatar Jan 29 '13 06:01 sdhull

OK. After doing that and formatting a simple erb file, this is what I get:

Screen Shot 2013-01-28 at 10 57 51 PM

<ul class="posts">
  <% @posts.each do |post| %>
    <li>
  <%= image_tag post.image %>
  <%= content_tag :span, post.caption if post.caption.present? %>
  </li>
<% end %>
</ul>
<a id="prev" href="#">&laquo;</a>
<a id="next" href="#">&raquo;</a>

Yuck x 1,000

sdhull avatar Jan 29 '13 06:01 sdhull

FWIW, without setting that variable, when I try to print its value, VIM says E121: Undefined variable:g:html_indent_tags

sdhull avatar Jan 29 '13 07:01 sdhull

Oh I haven't checked on an erb, I'll do that later today, I only checked editing an html file

kalbasit avatar Jan 29 '13 19:01 kalbasit

indentation seems faulty here too, in .html.erb files at least... using gg=G is not very useful anymore since I started using Janus, which is awesome btw, I just don't know if it's something I did that made it behave like this since everything else works so well

it seems it's not getting scriptlets very well too, ex:

<div>
  <% if true %>
    bla
  <ul>
    <li>
    blabla
    </li>
  </ul>
<% end %>
  <hr />
</div>

Note: I've run rake on ~/.vim/ today to see if I wasn't missing any updates

salgadobreno avatar May 15 '13 17:05 salgadobreno

html5 elements are also not indented i.e. <header>, I can't set g:html_indent_tags in .vimrc.after because apparently the variable is not initialized at that point yet. I reckon we should put this in after/indent/html.vim but alas, that does not work for me either.

riffraff avatar May 10 '14 09:05 riffraff