General Computing
vim copy-paste cut-and-paste yank
Updated Mon, 13 Jun 2022 21:24:11 GMT

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


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?




Solution

Use d where you normally use y.





Comments (3)

  • +1 – In Vim, what you delete is kept in the buffer. So what you delete, you can indeed paste afterwards. — Apr 28, 2010 at 13:39  
  • +0 – Doh! I can't believe I didn't try that. :-/ — Apr 28, 2010 at 15:50  
  • +1 – @Gnoupi: the vimish term is "register", one can see the content of the registers by ":registers" — May 28, 2010 at 05:52