How can I get the vim closetag plugin to work in all html tags?

I use the closetag.vim plugin, but it does not work for all tags. The plugin code has ignored var tags that contain some that I noticed did not close ex dd dl, but there are many others that are not on a list that does not work (p, ul, li).

Nothing similar happened after updating the list of ignored tags.

To make this plugin work, you simply enter the tag text and click the tab, right? those. div

Did I miss something?

+4
source share
3 answers

How did you install the plugin?

I had problems with closetag.vim when I installed it in ~/.vim/plugins . Then I moved it to ~/.vim/scripts and added the following to my .vimrc :

 :let g:closetag_html_style=1 :source ~/.vim/scripts/closetag.vim 

and now it works great for me. I found that it closes all tags (including those that are on the ignore list), but not those that are self-closing (for example, <img/> ).

In the version of the script that I am using (0.9.1), it defines <C-_> as a trigger to complete the tags. If you matched the command with <tab> , this should work too.

+3
source

I also canโ€™t get this plugin to work, however, in my case, what it does is it throws some error messages before it finally works. For example, if I try to close the H1 tag, I will get the Error Detected while processing function GetCloseTag error, and the error will be undefined variable b:UnaryTagsStack .

It seems like this would be a useful plugin, but it just wonโ€™t work together.

+1
source

I had the same problem and the answer to nelstrom above did not solve for me. What worked for me was adding the following lines to my .vimrc:

 if !exists("b:unaryTagsStack") || exists("b:closetag_html_style") if &filetype == "html" || exists("b:closetag_html_style") let b:unaryTagsStacktack="area base br dd dt hr img input link meta param" else " for xml and xsl let b:unaryTagsStack="" endif endif if !exists("b:unaryTagsStack") let b:unaryTagsStack="" endif 

I donโ€™t know why adding just let b:unaryTagsStack="" didnโ€™t help, but the combination above seems to fix it in all file types for me.

+1
source

All Articles