Thursday, December 24, 2020

Re: Substitute pattern over multiple lines

On 2020-12-24 14:43, Steve Litt wrote:
> On Wed, 23 Dec 2020 17:08:32 -0600
> Tim Chase <vim@tim.thechases.com> wrote:
>> 2 NOTE \zs
>>
>> This does join *all* the lines and doesn't re-wrap them, so you'd
>> then want a second pass to do the wrapping
>>
>> :set tw=70
>> :g/<div [^>]*>.*<\/div>$/norm gqq
>
> His destination is HTML so he doesn't need to wrap them: The browser
> will wrap them for him.

However he also wrote

"""
I want to surround the text of the NOTE with a 'div' tag, so that
the final result should look like this:

=======================
1 EVEN
2 TYPE tngnote
2 NOTE <div class="xxx">I have included the children William,
Charles, Alice, and with his parents in 1881, and with his widowed
mother in 1891 (e.g. see my online transcription of the 1891
Smiths with James Moser, son of Henry Moser and Mary Henneberry,
and his wife Margaret Woodin; however, I have not yet taken this
step.</div>
1 BIRT
=======================
"""

which included the wrapping (even if the HTML rendering engine would
do that for him) in the example desired output, so I included the
fairly straight-forward means by which one could do that if needed.

-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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20201224143527.693a87df%40bigbox.attlocal.net.

No comments: