Tested on Mac OSX El Capitan and Ubuntu 16.04
On the Mac side:
- Install XQuartz.
- Enable X11 clipboard syncing:
- Make sure XQuartz is running before continuing. I also had to launch the terminal app within XQuartz and keep it running in the background.
- Launch iTerm or your terminal app of choice.
- SSH into your remote server with X11 forwarding enabled, e.g.
ssh -X email@example.com
On the remote side:
- Install a version of vim with xterm_clipboard support. To check:
vim --version | grep clipboard
If you see +xterm_clipboard, you’re good to go. Otherwise, on Ubuntu:
sudo apt-get install vim-gtk
- Configure vim to alias the unnamed register to the + register, which is the X window clipboard. In your .vimrc, add:
- Start a new vim session and copy/paste should work between your local and remote machines.