Peng Yu schrieb:
Hi,
Suppose I want to replace "string1" with "string2" in a file from vim.
1. Highlight "string1" (in visual mode) and then type "y".
2. Highlight "string2" (in visual mode) and then type "p".
However, the problem with the above procedure is that "string2",
instead of "string1", is in buffer. That is if I highlight "string3"
and then type "p", "string3" will be replaced with "string2" instead
of "string1".
I'm wondering if there is any way to avoid change the content in the
buffer?
Thanks,
Peng
The Vim teacher already taught you ^^, so here is a hint _why_ this
happens:
:help put-Visual-mode
| (Implementation detail: it actually works by first putting the
| register after the selection and then deleting the selection.)
Obviously, the selection is deleted into the unnamed register, changing
it.
Andy
--
EOM
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de