> When I substitute using ":s/{pattern}/{string}/{option}", I prefer to use 
> "/{pattern}" to check out 
> whether the pattern is satisfactory. After checking, I will run the 
> substitute command. However, if 
> the pattern string is too complicated, typing it twice is boring. I would 
> like to know whether there is 
> any better way to copy the pattern from "/{pattern}" to 
> ":s/{pattern}/{string}/{option}".

The solution is painfully easy:

   :%s//{string}/{option}

By omitting the pattern, vim uses the last search pattern 
automatically.

I often do this using the #/* operators -- hit one of those to 
find the next word under my cursor, and then use a :s// like 
above to do a substitute across the matches.

-tim




--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to