Wednesday, February 2, 2011

Re: Copying and inserting a word in a search/replace

On Feb 2, 2011, at 11:37 PM, Colin Beighley wrote:

> Hello,
>
> I want to do something like this
>
> word => ,
>
> becomes
>
> word => word,
>

:%s/^word\ze => ,/& => &,/

% => whole file
^ => Beginning of line
\ze => end of text to be replaced
& => matched text

Replace 'word' with '\w\+' or '\a\+', see :h \w for more options.

Israel

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