Tuesday, November 5, 2013

Re: Paste with movements

On 2013-11-05 09:26, Егор wrote:
> I have text like this
> <a href="http://example.com/" class="test-class">Link</a>
> Now I want change link text. Also in buffer I have text I need to
> set to link. I need to put cursor on "L" paste from buffer with "P"
> key and then delete text from "L" till "<". Is it possible to paste
> text with deleting word? It would be great to do like this "pt<"
> paste till "<". Or if i want change link class, use 'pi"' like 'ci"'

If you paste with a visual-selection, it will overwrite it, so it
sounds like you want to do something like

1) go yank the text you want to paste

2) anywhere between the opening "<" and the final ">" issue

vit

to select the "Link" text visually. You could also manually
select the text you want to replace, but Vim's text-objects make
this trivial.

3) press "p" to paste. If you want to paste the same text multiple
times, you also have it stored in the "0 register, so you can use

"0p

to ensure that you don't get the previous tag's text-content

-tim

:help v_p
:help v_it
:help quote0





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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: