Copy and paste in vim via keyboard between different mac terminals?

落爺英雄遲暮 提交于 2019-12-02 19:28:02

Could you add the output of :version?

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 +).

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).

EDIT

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

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.

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).

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'

If you want to copy an entire file into your target file.

Open your target file in vim.

Put your cursor where you want it and type the following:

:r /path_to_file/file.ext

This will copy an entire file to where your cursor is...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!