通过键盘在不同的Mac终端之间复制和粘贴Vim? [英] Copy and paste in vim via keyboard between different mac terminals?

查看:181
本文介绍了通过键盘在不同的Mac终端之间复制和粘贴Vim?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮助我吗? 我试图弄清楚如何在不同终端上(使用iterm2或mac终端)在2个不同的vim实例之间复制和粘贴文本.如果执行:set mouse = a",我可以使用鼠标来完成,但是我希望能够使用键盘来完成.

Can anyone help me with this: I'm trying to figure out how to copy and paste text between 2 different instances of vim on different terminals (using iterm2 or mac terminal). I can do it using the mouse if I do ":set mouse=a" but I'd like to be able to do it using the keyboard.

我到处搜索,它说您可以使用"*或" +寄存器从系统剪贴板复制/粘贴到/从系统剪贴板粘贴,但是当我在vim中键入*或+时,mac会发出其中一种声音当你不能做某事时.我也做了:set剪贴板=未命名",但这也没有用.

I've googled around and it says you can use the "* or "+ registers to copy/paste to/from the system clipboard, but when I type * or + in vim, the mac makes one of those sounds it makes when you can't do something. I've also done ":set clipboard=unnamed" but that hasn't worked either.

我正在使用Mac OSX 10.7(Lion)和iTerm2或Mac终端.

I'm using Mac OSX 10.7 (Lion) and iTerm2 or Mac terminal.

感谢您的帮助

推荐答案

是否可以添加:version的输出?

我可以在Terminal.app窗口A中运行的一个Vim实例中用yyy猛拉,并在Terminal.app窗口B中运行的另一个Vim实例中将pP放到该行中我的~/.vimrc:

I can yank with yy or y in one Vim instance running in Terminal.app window A and put with p or P in another Vim instance running in Terminal.app window B with this line in my ~/.vimrc:

set clipboard+=unnamed

不使用特定的剪贴板寄存器(*+).

without using specific clipboard registers (* or +).

那为什么在不同的终端上运行两个Vim实例呢? SSH/本地?如果其中一个在SSH会话中,则由于两台计算机(本地/远程)不共享相同的剪贴板,因此无法进行拉动/放置操作.

And why do you have two Vim instances running in different terminals? SSH/local? If one is in an SSH session yanking/putting won't work because the two machines (local/remote) don't share the same clipboard(s).

编辑

我怀疑Vim的编译没有正确的标志.显然是这样.

I suspected that Vim wasn't compiled with the right flag(s). Apparently that's the case.

因为您使用的是Mac OS X的默认Vim,所以我认为您不需要重新编译甚至编译任何东西,因为它通常会带来更多问题,而不是值得的.

Since you are using Mac OS X's default Vim my opinion is that you shouldn't need to re-compile it or even compile anything as it often leads to more problem's than it's worth.

相反,下载最新的MacVim构建并使用MacVim捆绑软件中的(CLI)Vim可执行文件:它具有与MacVim相同的功能(当然,在CLI的限制内).

Instead, download the latest MacVim build and use the (CLI) Vim executable within MacVim's bundle: it has all the same functionalities as MacVim (within the constraints of the CLI, of course).

将此行添加到~/.bashrc~/.profile或用于放置别名和自定义bash函数的任何位置:

Add this line to your ~/.bashrc or ~/.profile or wherever you are used to put aliases and custom bash functions:

alias vim='/path/to/MacVim.app/Contents/MacOS/Vim'

这篇关于通过键盘在不同的Mac终端之间复制和粘贴Vim?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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