在vim用C Autoclose XML标签/ C ++文件 [英] Autoclose xml tags in C/C++ file in vim

查看:202
本文介绍了在vim用C Autoclose XML标签/ C ++文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有嵌入源$ C ​​$ C(C / C ++文件)内,XML标记一些文档字符串,我想知道什么是最起码的解决方案,使 VIM 自动关闭的标签(最接近匹配的标签)。

I have some documentation strings embedded within the source code (C/C++ files) as XML tags and I'd like to know what's the most minimal solution to make vim autoclose the tags (closest matching tag).

我发现 closetag.vim ,但有没有去做到这一点整齐,而无需修改任何东西,但的.vimrc 文件?

I've found closetag.vim but is there away to do this neatly without modifying anything but the .vimrc file?

推荐答案

Vim有没有内置该支持,所以的 closetag.vim 的插件是正确的,最简单的解决方案。 (我用它自己,太!)当然,你可以开发自己的简单映射(一个开放标记,搜索倒退,获取,删除属性,添加斜线,并插入),但是:

Vim has no built-in support for that, so the closetag.vim plugin is the proper and easiest solution. (I use it myself, too!) Of course, you can develop your own simple mappings (that search backwards for an open tag, get that, drop the attributes, add the slash, and insert that), but:


  • 这要么是非常简单的,因此经常出错

  • 或尽可能多的复杂性closetag最终,成为该插件
  • 的重新实现

如果一些比较奇怪的限制(例如,跨系统的自定义基本同步)只允许你操纵的〜/ .vimrc 本身,你可以只追加整个插件的code到它(虽然我建议反对这样一个丑陋的黑客攻击)。

If some rather strange restrictions (e.g. a custom primitive sync across systems) only allow you to manipulate the ~/.vimrc itself, you could just append the entire plugin's code to it (though I'd recommend against such an ugly hack).

这篇关于在vim用C Autoclose XML标签/ C ++文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆