Tuesday, November 5, 2013

Re: Paste with movements

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

You can do

Pldt<

to exchange the contents of the unnamed register with whatever you
are deleting (the text "Link" in your example). However, this is
really an exchange, not just a paste: once done, the register will
hold the just deleted text and not what it used to.

If that is not ok, you can yank the text in a register, say r, then
paste the contents of that register:

"rPldt<

To avoid repeating the above sequence, paste it into another register,
say s. Then, doing

@s

will replace whatever text up to < with the contents of the r
register. This is both succinct and flexible: r holds the text to
be pasted, s tells how to use it, and you have full control over each
one individually.

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