othree / html5.vim

HTML5 omnicomplete and syntax
http://www.vim.org/scripts/script.php?script_id=3236
934 stars 76 forks source link

Indent specific markers #69

Closed perrette closed 8 years ago

perrette commented 8 years ago

I am using reveal.js and would find it convenient to indent <session> markers automatically in vim. Any hint how to achieve that? Thanks!

othree commented 8 years ago

It's related to #63, but still don't have time to solve it :)

perrette commented 8 years ago

I see. One open issue is probably enough... Thanks.

unrelated PS: that only one or two courageous people like you went down the hard way of writing github-tracked VIM extension for HTML+js is probably a (pessimistic) precursor sign of the future of vim compared to, say, sublime or Atom, written in more modern language which are maybe easier to customize? Or simply understood by more people, or just benefit from a larger audience and more people able to contribute? But the death of VIM was announced (disproven) many times, so I'll stop there. Thanks for your contribution anyway.

othree commented 8 years ago

I don't think Vim will die, because lots of people are still working on terminal. Not always have GUI to work :)

othree commented 8 years ago

Maybe fixed, just run several small tests, ref. 5b13cd0a60bcce78df697faf35cdb98606985d44

perrette commented 8 years ago

For some reason I still can't get the indentation to work (regardless of additional .vimrc line let g:html_indent_inctags = "section"). But maybe that's due to interaction with another option...

Just in case you spot immediately something wrong, here is a stripped-off version of my vimrc:

set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

" let Vundle manage Vundle
Bundle 'gmarik/vundle'

filetype off
syntax on

" Tabs as space
set shiftwidth=2 softtabstop=2 smarttab expandtab

Bundle 'othree/html5.vim'

" indent <section> tag (reveal.js)
let g:html_indent_inctags = "section"

filetype plugin indent on
perrette commented 8 years ago

PS: sure there is not always a GUI, though I hope HTML developers do have one ! I am more thinking of the choice of VIM as main editor. Just thinking it might have a hard time with modern, well-designed, customizable editors, which work out-of-the-box for a number of common tasks. Only a user's perspective: I am still at vim, but I feel the wind could turn (the main current barrier being: learning to do the same with Sublime, what I already know in VIM - that is not a good reason to use VIM ! This is an intuition anyway, it could also be a round trip back to VIM at the end, never been there to tell)

perrette commented 8 years ago

What I mean with indentation, is that given:

<section>
<section>
something
</section>
</section>

should be automatically indented to:

<section>
  <section>
    something
  </section>
</section>

(here with TAB = 2 spaces)

othree commented 8 years ago

Use gg=G to indent entire file for test?

perrette commented 8 years ago

Yeah, it looks like:

<html>
  <head>
    <div>
      This is indented properly.
    </div>
  </head>
  <body> 
    <div>
      <section>
      <div> 
        The section part is not indented, why? 
      </div>
      </section>
    </div>
  </body>
</html>
othree commented 8 years ago

So it looks well as expected. Except the <section> part.

perrette commented 8 years ago

Yes. I wonder why... I attached my minimal .vimrc and test.html (and edited the above examples accordingly).

minimal_setting.zip

othree commented 8 years ago

How about remove the line

let g:html_indent_inctags = "section"
perrette commented 8 years ago

Niet.

perrette commented 8 years ago

Note by the way that having Bundle 'othree/html5.vim' or not does not change anything at all either...