How to copy and paste data between remote vps'vim and local vim?

You can't even paste text from two different vim processes on the same host, so you can't from processes on different hosts.

What you can do is for short texts copy text from vim in one terminal window to the host's clipboard and paste it from the host's clipboard into the vim in the other terminal window. If you don't use a terminal window, you can also use tmux for similar effects. A ssh session inside emacs would also work, but you wouldn't ask about vim if you wanted to use emacs.

For longer texts I would copy them to/from the remote host with a porgram like scp and then use the file locally.


You can open the remote file by running vim scp://user@vps_ipi/remote_file and then open your local file with :e local_file, after that you can switch between the buffers with :bn and use the yy and p commands for copy and paste between the buffers.

I make a test opening a remote script, then copy all its content with ggVGy switched the buffer :bn and paste with P.

Tags:

Vim

Ssh

Remote