On 03/09/12 18:36, Yue Wu wrote:
Hi, list,
I want to delete all regions between line '#begin' and line '#end' in a
buffer, for example, a buffer:
----------------------
#begin
region1
#end
Some text.
#begin
region2
#end
Some text.
Some text.
Some text.
----------------------
will become:
----------------------
Some text.
Some text.
Some text.
Some text.
----------------------
after the operation, how to do it in vim?
There are several variants depending on how closely you want it
to match your output with regards to intervening whitespace. The
general pattern is something like
:g/#begin/;/#end/d
to delete just those bits. If you have whitespace around each
block and you want to smash that a bit, you can use
:g/#begin/norm dap
You can tighten up those regexps to "^#begin$" and "^#end$" if
you have them in other locations that you want to preserve.
-tim
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php