Vim:通过SSH访问系统剪贴板-Linux到OS X [英] Vim: access to system clipboard via ssh - Linux to OS X

查看:69
本文介绍了Vim:通过SSH访问系统剪贴板-Linux到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.

  1. /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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆