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