Reputation: 437
Local OS: Mac High Sierra
Remote OS: Linux, Debian
In vim, I'd like to enable displaying line numbers as well as enabling copy to system clipboard on both Mac and Linux. At this moment, I created the same .vimrc file in both systems with the below configurations:
set number " display line numbers set mouse=a
I also tried set mouse=r
and set mouse=v
as suggested in other posts, the issue was not fixed.
Upvotes: 0
Views: 98
Reputation: 196886
The local clipboard and the remote clipboard need to be synchronized for this to work. From this gist:
Make sure you have a clipboard-aware Vim build. I recommend MacVim.
Install or update XQuartz.app and start it.
In the Preferences window, activate clipboard synchronization.
Quit XQuartz.app.
In iTerm.app or Terminal.app, connect to your remote machine with:
$ ssh -X username@host
and see the XQuartz.app icon pop-up in your Dock.
From now on, XQuartz.app will start automatically in the background when you use the -X
flag, taking care of the clipboard synchronization for you.
If you don't already have it, install GVim. On Debian-based systems, use:
$ sudo apt-get install vim-gtk
The idea is not to use Gvim but installing it gets you everything you need to get clipboard sharing to work:
In Vim, synchronize the unnamed and clipboard registers by adding this line to ~/.vimrc
:
set clipboard^=unnamed
Upvotes: 1