On May 26, 9:49 pm, [email protected] wrote:
> Hi there,
> 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}".
>
You've got an answer (omit the pattern and the last pattern will be
used), but you can also insert the "last search" register into your
command, especially if you want to edit the pattern.
Simply type:
:s/
then type CTRL-R and then /
This will insert the text currently contained in the "/" register,
which is the last-used search pattern.
Finally, finish off your command.
Read more at :help quote/ and :help c_CTRL-R
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---