It's great enough. Thanks.

Regards,

Ben Kim


On Thu, 10 Dec 2009, Tim Chase wrote:

>> If I search for "\<someword\>' using * on a word, and want to use it as
>> the search pattern for replace, like :%s/\<someword\>/otherword/
>> 
>> Is there a shortcut for that last searched pattern?
>
> It doesn't get more "shortcut" than
>
>  :%s//otherword/
>
> From the help (":help change.txt" and search for this text...sorry there's no 
> nice tag to drop you right next to it):
>
>  If the {pattern} for the substitute command is
>  empty, the command uses the pattern from the last
>  substitute or ":global" command.
>
> (and I'd add "or search" to the text, which includes the */# operators)
>
> However, the last search is also accessible in the "/" register, which you 
> can 
> bring into any insertion, search or command-line with control+R followed by 
> the slash ("/")
>
>  :he i_CTRL-r
>  :he c_CTRL-r
>
> for more info on that.
>
>> Likewise, if I undo the replace, and would like then to search for
>> "otherword", is there a shortcut too?
>
> I'm not sure there's an easy way to search for the *replacement* side of a 
> substitute.  Though I'd love to be proven wrong...I've occasionally reached 
> for this and been disappointed not to know a solution.
>
> -tim
>
>
>
>
>

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

Reply via email to