简体   繁体   English

Vim:删除包含开头和结尾的所有文本

[英]Vim: Delete all text surrounded by a start and an end

Say I've got this: 说我有这个:

    \item[1]\footnote{«footnote blah blah»}
footnote blah blah.
    \item[2]\footnote{«blah blah footnote»}
random text
    \item[3]\footnote{«this is not»}
more random text

I want to quickly delete \\footnote{*} (that includes \\footnote{«footnote blah blah»} \\footnote{«blah blah footnote»} and \\footnote{«this is not»}, but not \\item[x] or the lines below that. How is this achieved? 我想快速删除\\ footnote {*}(包括\\ footnote {«footnote blah blah»} \\ footnote {«blah blah footnote»}和\\ footnote {«this not not»},但不包括\\ item [x]或下面的那一行。这是如何实现的?

Thanks! 谢谢!

I think the most accurate way would be to use: 我认为最准确的方法是使用:

:%s/\\footnote{.\{-}}//g

This will delete footnote and everything in between the braces. 这将删除脚注和大括号之间的所有内容。 Using {.*} will delete everything up to the last brace even if it is outside of the footnote brace. 使用{.*}将删除最后一个括号的所有内容,即使它位于脚注括号之外。

在逃生模式

:1,$s/\\footnote{.*}//g

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM