I used to use "+y and "+p in vim for copy pasting across vim instances. This also has the advantage that you can use "+ as a register for any command you know, including deletions etc.

Now that I'm using vim on a server, this functionality is gone. Is there an easy way to configure "+ register to a file? Such that when I try to read from the register, it reads from the file, and when I try to write to the regsiter, it writes to the file.

In this way I can retain my muscle memory and provide a "clipboard" to vim.

1 Answer 1


If using NeoVim is an option, you can use g:clipboard to define hooks for copying to the clipboard and pasting from it, which should allow you to set it up in a way that will write or read from a specific file you can use for this purpose.

You can also consider setting up something like lemonade to have your remote server access your local clipboard, through a client/server setup. You can use SSH port forwarding to improve security in this solution (not having your server try to connect to an open port of your host where you're SSHing from.)

NeoVim will recognize "lemonade" automatically if installed and it will try to use it for "+ in that case. (See :help clipboard-tool.)

For original Vim, you can use a plug-in such as vim-fakeclip which can also integrate with "lemonade".

  • 1
    I did not know about lemonade, and I have to say that this is magic. Thanks for including it in your answer, even though the question didn't specifically ask for it. May 11, 2020 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.