Replacing a word from register

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Replacing a word from register

RichardF
Hi,

Is there a way to replace-put from a register .  ie I
type yW, then i move the cursor to another word and
then i want do a cW whilst simultaneously putting from
the register i just yanked.

Hope that makes sense.

Thanks,
Rich.


               
___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
Reply | Threaded
Open this post in threaded view
|

Re: Replacing a word from register

jn-4
I use

  vW"xp

where 'x' is the register, so that I select the word in visual mode and
paste there. Substitute the 'W' by whatever you want to paste over -
viw"xp is often useful.

  J

----------------------------------------
ViEmu - http://www.ngedit.com/viemu.html
  vi/vim emulation for Visual Studio


> Hi,
>
> Is there a way to replace-put from a register .  ie I
> type yW, then i move the cursor to another word and
> then i want do a cW whilst simultaneously putting from
> the register i just yanked.
>
> Hope that makes sense.
>
> Thanks,
> Rich.
>
>
>
> ___________________________________________________________
> To help you stay safe and secure online, we've developed the all new
> Yahoo! Security Centre. http://uk.security.yahoo.com
>

Reply | Threaded
Open this post in threaded view
|

Re: Replacing a word from register

A.J.Mechelynck
In reply to this post by RichardF
----- Original Message -----
From: "PopIdol" <[hidden email]>
To: <[hidden email]>
Sent: Tuesday, September 06, 2005 4:52 PM
Subject: Replacing a word from register


> Hi,
>
> Is there a way to replace-put from a register .  ie I
> type yW, then i move the cursor to another word and
> then i want do a cW whilst simultaneously putting from
> the register i just yanked.
>
> Hope that makes sense.
>
> Thanks,
> Rich.

The most recent yank is also in register zero; so you can use

    cW^R0

where ^R means "hit Ctrl-R". Ctrl-R 0 (in insert mode) inserts the contents
of register zero (the latest yank). The cW commands places what it deletes
into register " (or any other user-specified register), and also into
register 1, pushing all higher numbered registers one step higher.

Since the above commands leaves you in Insert mode, you can then use Esc to
return to Normal mode.


Best regards,
Tony.