Wednesday, April 9, 2014

Re: systematic replacement of text

On Wednesday, April 09, 2014 07:58:15 PM you wrote:

> I can't reproduce this with this exact macro:

>

> /\\xxx\>^Mdt{d%%x``x@q

>

> The result I get is what I'd expect:

>

> This is a text line. And the next will be a completely new line.

>

> Another line of text.

>

> Vim 7.4.253, editing a LaTeX file (this might be relevant).

>

> /lcd

 

Hi,

that is strange. I've tried again and that behavior persists.

I'm using Vim 7.4 and I'm editing a LaTeX file. I'm attaching a minimal file-example:

before.tex having the original source

after.tex having what I get after I applied the macro indicated above.

 

All the occurrences get transformed ok (even the last one, more complicated) but not the second one.

 

I also tried to apply the commands that make the macro directly to that 2nd occurrence and it fails when trying to do the `` command. Notice that it deletes one character (as x says) but it the wrong place (at the beginning of the previous xxx that had been already executed because it was from there it had jumped before). `` picks up the wrong jump, instead of the last, it picks up the last but one.

 

Before creating the macro I position the cursor for instance in the line

\begin{document}

so that that zero occurrence of xxx (where I define the command \xxx.

 

Am I overlooking something?

Natércia

 

 

No comments: