macos OSX 中的 Vim:如何将文本从打开的窗口粘贴到 vim 中的打开文件中?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7426175/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Vim in OSX: How to paste text from open window into a open file in vim?
提问by TCSGrad
In linux, I used Shift+ Insertto paste anything in the system clipboard into the terminal. In Mac, there isn't an insert key - so, I'm left wondering how to do that ?
在 linux 中,我使用Shift+Insert将系统剪贴板中的任何内容粘贴到终端中。在 Mac 中,没有插入键 - 所以,我想知道如何做到这一点?
回答by Michael Hansen
The standard Mac paste shortcut, Command-v, should paste the contents of the clipboard into vim, running in a terminal window, assuming vim is in insert mode. I just pasted the previous sentence into vim on my Mac, by that method. If you are new to Macs, and you have an Apple keyboard, the Command keys have an apple and a strange symbol resembling an octothorpe, with a loop at each corner. On my 3rd party keyboard, they are labeled with a diamond-shaped symbol.
标准 Mac 粘贴快捷方式 Command-v 应将剪贴板的内容粘贴到 vim 中,并在终端窗口中运行,假设 vim 处于插入模式。我只是通过这种方法将上一句粘贴到我的 Mac 上的 vim 中。如果您是 Mac 新手,并且您有一个 Apple 键盘,那么 Command 键上有一个苹果和一个类似八角的奇怪符号,每个角都有一个环。在我的第 3 方键盘上,它们标有菱形符号。
回答by sashang
This works with Macvim. The copied text is placed in the +
register then in the macvim buffer hit "+p
and the text will be pasted into the buffer. I find this quicker than using command-v,comand-c.
这适用于 Macvim。复制的文本被放置在+
寄存器中,然后在 macvim 缓冲区命中"+p
,文本将被粘贴到缓冲区中。我发现这比使用 command-v,comand-c 更快。
If you're using console vim then it is placed in the .
register. Hit ".p
to paste the text from the clipboard.
如果您使用的是控制台 vim,那么它会被放置在.
寄存器中。点击".p
以粘贴剪贴板中的文本。
回答by toobsco42
In Ubuntu, Shift+Insertis used to paste highlighted text, not to paste text copied in the buffer that was copied using Ctrl+C.
在 Ubuntu 中,Shift+Insert用于粘贴突出显示的文本,而不是粘贴在使用Ctrl+复制的缓冲区中复制的文本C。
In macOS this functionality of pasting highlighted text can be done with ?Shift+?Command+V.
在MacOS上粘贴高亮文本的这个功能是可以做到?Shift+ ?Command+ V。
I hope this helps any users that are coming from Ubuntu.
我希望这可以帮助任何来自 Ubuntu 的用户。