Friday, March 4, 2011

Re: search and replace with word list

On Mar 4, 3:58 am, Jürgen Krämer <jottka...@googlemail.com> wrote:
> Hi,
>
> jcordes wrote:
>
> >  Tim,
> >  I would like to have a better understanding of the line
> >>    :%s@.*@:-/MODULEX/s//&
>
> >  The two appearances of the @ symbol is puzzling me. Is this something
> > to do with a search range for the substitute command, or executing a
> > macro, or what?!
>
> in the :substitute command you can use almost any non-alphanumeric
> character for surrounding the search pattern and the replacement string.
> Especially in this case this spares you the need for backslash-escaping
> all the slashes in the replacement text. Otherwise you would need to
> write
>
>   :%s/.*/:-\/MODULEX\/s\/\/&
>
> You can read about this at
>
>   :help E146
>
> Regards,
> J�rgen

Thank you for this response. I am aware of this possibility (of using
other characters in the case where a forward slash already appears in
the search pattern), but I still do not understand. I did emphasize
that I saw only *two* occurrences of the "@" character -- where is the
third @? I think I am confused by the fact that this is not a
straightforward 'substitute' command -- at least so it appears to me.

John

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

No comments: