How to copy and paste text out of a remote vim to a local vim

copy/pastesshvim

I'm editing a file in vim on a remote machine via ssh and I want to copy text out of the remote file and paste it into a vim instance running on my local machine. Is there an easy way to do this? I can use my terminal emulator's selection features to select text that is currently on the screen, but if my selection is larger than can fit on the screen, I'm out of luck.

Best Answer

Open the remote file in the local vim session:

  :e scp://user@host/relative/path/from/home.txt