,我有以下的,我在Vim
打开的文件的代码:如何删除HTML标签,而不是内容的Vim
<p>Hello stackoverflow!</p>
如何删除<p>
和</p>
标签,但保留的内容他们?也就是说,我应该怎么按,以结束与:
Hello stackoverflow!
我知道按d我吨会做相反。
我正在使用Janus。
,我有以下的,我在Vim
打开的文件的代码:如何删除HTML标签,而不是内容的Vim
<p>Hello stackoverflow!</p>
如何删除<p>
和</p>
标签,但保留的内容他们?也就是说,我应该怎么按,以结束与:
Hello stackoverflow!
我知道按d我吨会做相反。
我正在使用Janus。
随着surround.vim插件安装,按dst to d elete s urrounding t ag。
类似的快捷方式:
()
""
''
等等...
爱兰迪(+1)的答案,我只是了解了标签块!这只是一个补充答案。
所以yit的意思是“内藏标签块”,而桶意味着“进入视觉模式并选择a(全部)标签块”。
这仅仅是对于那些懒得看帮助文件:
Tag blocks *tag-blocks*
For the "it" and "at" text objects an attempt is done to select blocks between
matching tags for HTML and XML. But since these are not completely compatible
there are a few restrictions.
The normal method is to select a <tag> until the matching </tag>. For "at"
the tags are included, for "it" they are excluded. But when "it" is repeated
the tags will be included (otherwise nothing would change). Also, "it" used
on a tag block with no contents will select the leading tag.
"<aaa/>" items are skipped. Case is ignored, also for XML where case does
matter.
In HTML it is possible to have a tag like <br> or <meta ...> without a
matching end tag. These are ignored.
The text objects are tolerant about mistakes. Stray end tags are ignored.
这是我的解决方案。谢谢。 – retro 2011-06-07 11:13:43
这应该是最有价值的答案,因为每个人都应该使用TPopes真棒插件这些天! :) – walialu 2014-11-14 07:50:05
我知道'di ...'和'da ...',但我刚刚了解到'ds ...'。非常有用! – 2017-06-20 16:51:01