Today I tried using Vim over SSH on a remote machine. I needed to copy some configuration to the server.

I opened Vim in the terminal (via SSH): vim config.txt

I wanted to paste into the Vim buffer. I tried to use the "+p command in normal mode to paste from the system clipboard.

Unfortunately, that didn’t work. Solution:

The “clipboard” is a feature of X11, so you will need to enable “X11 forwarding” for the SSH connection in “trusted” mode:

$ ssh -Y myserver`

(By default, X11 is forwarded in “untrusted” mode, which is somewhat too restrictive. -Y disables the restrictions.)

Further Reading