Wednesday, April 9, 2014

Re: systematic replacement of text

Hi again LCD,

I've got an interesting situation where the suggestion below fails:

This is a text line. And the next will be a completely new line.
\xxx{\%danger}{}
Another line of text.

The change isn't performed as it was supposed...
Instead of nothing in that middle line it leaves a {

The `` seems to work in a different way here.

Otherwise, it has passed all the tests :)

Natércia


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