When editing xml, xml.vim works great for tag close. But when editing html, it does not work. Vim version is 7.3
I do not know, where you have found xml.vim, but it is probably due to filetype: xml filetype is xml and html one is html, so xml.vim is not loading. You can do the following:
- Change filetype to
xmlforhtmlfiles. - Add a symlink to
xml.vimto~/.vim/ftplugin/html/. Add a sourcing of
xml.vimforhtmlfiles to your vimrc:augroup vimrcHTMLsoXML autocmd Filetype html runtime! ftplugin/xml.vim augroup END
I'm not sure what exactly you are asking, but the reason is probably that classical HTML is much less strict with which tags have to be closed. In HTML it's common to have tags that are not explicitly closed, like for example <p>. My guess would be that therefore vim isn't as eager to close tags when editing HTML.
If you write XHTML and always want all tags closed, maybe setting the file mode to XML with setf xml will help. If you don't write XHTML it might be that xml.vim gets confused by all the unclosed tags and therefore doesn't work correctly.