Wednesday, April 9, 2014

Fwd: Re: systematic replacement of text

(the second. Natércia)

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

Subject: Re: systematic replacement of text
Date: Wednesday, April 09, 2014, 03:59:44 PM
From: Natércia Fernandes <natercia@eq.uc.pt>
To: LCD 47 <lcd047@gmail.com>

Hi LCD,
thank you for your suggestion.
I also wasn't aware that the macro could call itself :)

By the way, I committed a mistake when typing in my email the solution I had
tried before posting (which would work only for a single occurrence). Indeed,
what I really had done was:

/\\xxx
el
d%
%
x
N
5x

I haven't tried it yet, but I guess that if I add @q at the end of my commands
for macro in register q, it might work as well.

Thank you once more to everyone who has tried to help me.

Natércia


On Wednesday, April 09, 2014 05:01:26 PM you wrote:
> A shorter version, with a less awkward way to remove the { ... }
> around "argument 2":
>
> qqq - clear out register q
> qq - start recording a macro in register q
> /\\xxx\> - search for \xxx
> ^M - press enter to finish the search
> dt{ - delete to the next {
> d% - delete to the matching } (deletes {argument 1})
> % - jump to the final }
> x - delete the final }
> `` - go back to the position before jump
> x - delete the {
> @q - make the macro invoke itself
> q - finish macro recording.
>
> /lcd
-----------------------------------------

--
--
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