1

(previously posted on https://stackoverflow.com/q/62000643/3206025 before I get that there is a Vi's SE)

Here my vimrc

filetype plugin indent on
set autoindent 
set tabstop=2 
set shiftwidth=2 
set softtabstop=2 

And that all.

Let suppose I start a new xml file.

WHen a use normal tag, autoindent work well

<div>
  <p> 
     Some text
  </p>
</div>

But if I insert autoclosing tags, autoindnet don't recognize the autoclosing feature,and I get something like this.

<div>
  <p> 
     Some text<lb />
        Some text<lb />
             Some text<lb />
  </p>
</div>

I use vim 8.1.2269. I tried with nvim 0.4.3 > same problem. WHat is strange is that in the past (before my new fresh installation of Ubuntu), I didn't get any problem...

  • 1
    Welcome to Vi and Vim! – filbranden May 26 at 22:22
  • You can try using gq since the xml filetype sets formatexpr, but I didn't see anywhere (after a quick peek) that the scripts handle self-closing tags. – D. Ben Knoble May 26 at 23:21
  • I believe @ChristianBrabandt is the maintainer of XML indentation in Vim, so maybe he might know why it seems to handle this case incorrectly? – filbranden May 27 at 1:00
  • 1
    thanks for you answer. I will post on github repository. – Maïeul May 28 at 9:26
1

Thats was a bug. Thanks to @ChristianBrabandt who solved it very quickly.

https://github.com/chrisbra/vim-xml-runtime/issues/25

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.