Vim:通过SSH访问系统剪贴板-Linux到OS X [英] Vim: access to system clipboard via ssh - Linux to OS X
问题描述
我是Linux用户,经常需要通过SSH在远程OS X服务器上工作.我更喜欢vim(neovim)编辑器,但是我在通过SSH复制/粘贴到系统剪贴板中时遇到了问题.当我尝试复制行"*yy
时,它将保存在远程OS X剪贴板上.有没有办法将其保存到我的Linux剪贴板中?
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?
推荐答案
基本上,您可以在Linux机器上打开远程文件,例如:
Basically, you can just open remote file on your linux machine like:
:e scp://user@host/relative/path/from/home.txt
直接从ssh会话复制的另一种解决方案是在ssh中进行X11转发,它将连接远程和本地计算机之间的系统剪贴板.
Another solution to copy directly from ssh session would be X11 forwarding in ssh which connects system clipboard between remote and local machine.
-
在
/etc/ssh/sshd.conf
在连接时使用ssh客户端的-Y选项启用它:
ssh -Y your_server
Use the -Y option for ssh client to enable it when connecting:
ssh -Y your_server
现在,您可以使用"*yy
复制到远程Vim中,然后使用"*p
将其粘贴到Vim中,或者使用 Ctrl-V 将其粘贴到任何GUI应用程序中.
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.
这篇关于Vim:通过SSH访问系统剪贴板-Linux到OS X的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!