如何让 vim 的 closetag 插件适用于所有 html 标签?
我正在使用 closetag.vim 插件,但它似乎不适用于所有标签。在插件代码中,有一个被忽略的标签 var,其中包含一些我注意到没有关闭 ex dd dl 的标签,但还有许多其他标签不在列表中,无法正常工作(p、ul、li)。
更新忽略标签列表后似乎没有发生任何事情。
要让这个插件工作,你只需输入标签文本并单击选项卡,对吗? ie div
我错过了什么吗?
I am using the closetag.vim plugin, but it doesn't seem to work for all tags. In the plugin code there is the ignored tags var that contains some one that I noticed were not closing ex dd dl, but there are many others that aren't in the list that are not working (p, ul, li).
Nothing seemed to happen after updating the list of ignored tags.
To get this plugin to work you just enter the tag text and click tab, right? ie div
Am I missing something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你是如何安装插件的?
当我将 closetag.vim 安装在
~/.vim/plugins
中时,我遇到了问题。然后我将其移至~/.vim/scripts
中,并将以下内容添加到我的.vimrc
中:现在它对我来说工作得很好。我发现它关闭所有标签(包括“忽略”列表中包含的标签),但不关闭那些自动关闭的标签(例如
)。
在我使用的脚本版本(0.9.1)中,它将
定义为完成标签的触发器。如果您已将命令映射到
,那么这也应该有效。How did you install the plugin?
I had troubles with closetag.vim when I installed it in
~/.vim/plugins
. Then I moved it into~/.vim/scripts
instead, and added the following to my.vimrc
:and now it works fine for me. I find that it closes all tags (including those included in the 'ignore' list), but not those that are self-closing (e.g.
<img/>
).In the version of the script that I am using (0.9.1), it defines
<C-_>
as the trigger for completing tags. If you have mapped the command to<tab>
, then that should work too.我也无法让这个插件工作,但是就我而言,它的作用是在最终工作之前抛出许多错误消息。例如,如果我尝试关闭 H1 标签,我将收到错误
处理函数 GetCloseTag 时检测到错误
,并且错误是未定义的变量 b:UnaryTagsStack
。看起来这将是一个有用的插件,但它就是不合作。
I also cannot get this plugin to work, however in my case what it does it throw out a number of error messages before finally working. For instance if I try to close an H1 tag I will get the error
Error Detected while processing function GetCloseTag
and the error is anundefined variable b:UnaryTagsStack
.Seems like it would be a useful plugin but it just won't cooperate.
我遇到了同样的问题,纳尔斯特罗姆上面的回答并没有为我解决。对我有用的是将以下几行添加到我的 .vimrc 中:
我不知道为什么仅添加
let b:unaryTagsStack=""
并没有解决问题,但上面的组合似乎可以修复它对我来说适用于所有文件类型。I had the same issue and nelstrom's answer above didn't solve it for me. What worked for me was adding the following lines to my .vimrc:
I don't know why adding just
let b:unaryTagsStack=""
didn't do the trick, but the combination above seems to fix it in all file types for me.