开发者

xml.vim does not close tag for html automatically

When editing xml, xml.vim works great for tag close. But when editin开发者_高级运维g 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:

  1. Change filetype to xml for html files.
  2. Add a symlink to xml.vim to ~/.vim/ftplugin/html/.
  3. Add a sourcing of xml.vim for html files 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜