On 02/21/2011 11:41 AM, David Kahn wrote:
Relatively new to vim. I know there are other ways to do this specific
task such as search/replace but I want to understand how to repeatedly
paste some text but also overwrite a certain character, in the case I
want to do it manually. This has brought me to need to understand if
there is a sort of clipboard/yank history.

For example, I have yanked this text:

   .truncate(

I want to replace the comma ',' in the lines below with my yanked text
in each line:

   word,12)
   word2,12)
   word3,12)

So what I do is move in regular mode to the first comma and press 'x' to
remove the comma, and then press 'p'... however instead of getting my
yanked text, I get the text now under the cursor, in this case '1'. So
how do I handle a yank > delete > put operation, and multiple times?


If you do a single copy/replace, you can select text visually and press
'p' to paste over it.

Here you need to paste over multiple times, the way to do this is to
copy into a register, e.g. visually select text then press "py, then
select text to copy over and press "pp (I use p register because it's
easy to type pp).

See :h registers for more.

You can also delete some text without overwriting default register,
by using "_x, you can read about it in the same help topic.

There's also a plugin called 'yankring', you can yank multiple
texts and then press 'p' to paste last one and immediately after
that press ctrl-p and ctrl-n to navigate yank history.

 HTH, -Rainyday

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

Reply via email to