Vim clipboard in vagrant over ssh?

NOTE: if there are tools that you don't know how to use/install, and would need an explain/video on how to do it then checkout the resources for this blog at: https://elrey.casa/info

I love to use vim (as my bio says, and I will link to my .vimrc when it is cleaner 🙃️), ssh, and vagrant. So one of the things I do in a lot of my Vagrant file is add x11 forwarding, below is what you can add to enable it.

One of the things that I haven't been able to find is an article on, is being able to use the vim clipboard module with X11 forwarding. There are some people who are using a hack around with xclip (found here, but it isn't elegant).

So, all I have done is install vim-gtk3 and use the -X option when ssh'ing (not in a vagrant box). That is it, below is an asciinema recording of my terminal.

notes:

  1. When I paste the text at the end it is using Ctrl+Shift+v (using mate-terminal).
  2. This won't work on windows or osx by default checkout the resources page described above to get X11 fowarding to work for your OS
  3. here is the Vagrantfile used with the demo