Wednesday, April 9, 2014

Fwd: Re: systematic replacement of text

(By mistake I had sent 2 messages to private emails instead to of the list.
The other is going right after this one. Natércia)


---------- Forwarded Message ----------

Subject: Re: systematic replacement of text
Date: Wednesday, April 09, 2014, 02:23:29 PM
From: Natércia Fernandes <natercia@eq.uc.pt>
To: Karthick Gururaj <karthick.gururaj@gmail.com>

Hi,

thank you Claus, Jean-Rene, Karthick, and Ivan for your fast responses.

On Wednesday, April 09, 2014 05:38:51 PM you wrote:

> > [...]
> >
> >> Don't know if this info is needed or not: both argument 1 and/or argument
> >> 2
> >> can contain the symbols \ {}.
>
> But will the symbols be balanced? It must be - otherwise, how can we
> even tell what is 'argument 1'? Is it LaTeX?
Yes, they'll be always balanced. And yes, it is LaTeX.

[...]

> If the OP is not specifically looking to use the :substitute, a macro
> might also do the work?
>
> Search for \\xxx, go to end of the word and do d% for deleting all
> characters until a matching brace. Repeat the macro 'N' times, where N
> is sufficiently large. Make sure wrapscan is off.

In fact, I had already done it (or almost!) before I posted my question:
searched for \\xxx
looked for the matching brace of the 1st pair
looked for the matching brace of the 2nd pair
deleted it
searched backwards for \\xxx
looked for the matching brace of the 1st pair
deleted }{
searched backwards for \\xxx
deleted \xxx{

/\\xxx
el%
l%
x
N
el%
2x
N
5x

This way I also eliminate the unwanted 2nd pair of {}.
But I failed miserably not realizing the most obvious: I can repeat the macro
N times with N being a big enough number and making sure wrapscan is off.
Thank you so much for this hint!

Natércia

-----------------------------------------

--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment