Is there any way to do an emacs-like yank in vim?

2

In emacs, yanking works something like this: if you delete something, it can be yanked back into another position. In other words, emacs's yank is sort of like cut and paste. On the other hand, it seems like vim's yank is like copy and paste: I can yank something and then paste it elsewhere, but the original text is still there. Is there any way to cut the text rather than just copying it in vim?

Jason Baker

Posted 2010-04-28T13:31:45.817

Reputation: 6 382

Answers

6

Use d where you normally use y.

Ignacio Vazquez-Abrams

Posted 2010-04-28T13:31:45.817

Reputation: 100 516

1In Vim, what you delete is kept in the buffer. So what you delete, you can indeed paste afterwards. – Gnoupi – 2010-04-28T13:39:22.317

Doh! I can't believe I didn't try that. :-/ – Jason Baker – 2010-04-28T15:50:50.807

1@Gnoupi: the vimish term is "register", one can see the content of the registers by ":registers" – akira – 2010-05-28T05:52:52.303

0

You can also use x to delete individual characters (highlighted characters if in visual mode), and paste them using p.

J. Polfer

Posted 2010-04-28T13:31:45.817

Reputation: 2 234