Thanks Christian,
This seems nice. However, I won't be able to remember that, so I'm
trying
to write a small function, like this:
function SR(var1,var2)
let search=a:var1
let replace=a:var2
exe ':%s/\V'.escape(search,'/\').'/'.escape(replace,'/\').'/g'
return
endfunction
In such a that
:call SR(":%s#/\*(.*)\*/> #//\1#g","test")
should do the substitution. However, I've never wrote a function for
Vim, and there is something on the variable definitions that I'm not
getting wright. When there are some special characters in the
arguments
the function does not work.
Can you (or somebody else) readily perceive what is wrong?
Thanks a lot,
Leandro.
On Apr 17, 9:13 am, Christian Brabandt <[email protected]> wrote:
> Hi leandromartinez98!
>
> On Fr, 17 Apr 2009, leandromartinez98 wrote:
>
>
>
> > Thanks Tim,
> > I think that should do the trick, but I don't get exactly how to use
> > it.
>
> > For instance, I'm testing it, trying to replace this: [:%s#/\*(.*)\*/
> > #//\1#g] by "test", using:
>
> > :g/\V[:%s#/\*(.*)\*/#//\1#g]/s//test/g
>
> With \V you still have to escape \ and since you want to use a :g or
> :s command you would also have to escape /.
>
> Try something like this:
>
> :let a=':%s#/\*(.*)\*/> #//\1#g'
> :exe ':%s/\V' . escape(a,'/\') . "/test/g"
>
> regards,
> Christian
> --
> 184. You no longer ask prospective dates what their sign is, instead
> your line is "Hi, what's your URL?"
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---