Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim: access to system clipboard via ssh - Linux to OS X

Tags:

linux

vim

macos

ssh

I'm Linux user who often needs to work on remote OS X server via SSH. I prefer vim (neovim) editor but I have problem with copy/paste to/from system clipboard via SSH. When I try to copy line "*yy it saves on remote OS X clipboard. Is there a way to save it to my Linux clipboard instead?

like image 569
Artkik Avatar asked Mar 19 '16 22:03

Artkik


1 Answers

Basically, you can just open remote file on your linux machine like:

:e scp://user@host/relative/path/from/home.txt

Another solution to copy directly from ssh session would be X11 forwarding in ssh which connects system clipboard between remote and local machine.

  1. Enable X11Forwarding on the SSH server side in /etc/ssh/sshd.conf

  2. Use the -Y option for ssh client to enable it when connecting: ssh -Y your_server

Now you can copy in the remote Vim using "*yy and paste it locally in Vim using "*p or paste it in any GUI app using Ctrl-V.

like image 167
Ilya Lopukhin Avatar answered Sep 20 '22 13:09

Ilya Lopukhin