Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In a nutshell, I want the following:

  • y(ank) actually writes the yanked text to a line in a text file, maybe in your .vim directory
  • that line is prefixed with the name of the register, so "qyy yields q>my line of text
  • p(ut) gets the expected result from that file

The reasoning is to get more of a 'system wide' vim buffer to solve this problem:
Sharing Vim Yank Buffer

share|improve this question

2 Answers 2

I had the same question. I found following simple solution:

Edit your .vimrc file. Add the lines

map <C-y> <Esc>:'<,'>! cat \| tee ~/tmp/.myvimbuf<CR>

map <C-p> o<Esc>:.!cat ~/tmp/.myvimbuf<CR>

map <C-P> O<Esc>:.!cat ~/tmp/.myvimbuf<CR>

and make sure the directory ~/tmp is in place.

Open two instances of vim. If you now highlight a portion of text in one instance and hit CTRL+y and then hit CTRL+p or CTRL+SHIFT+p in the other instance, you should get what you want.

Obviously, the key combinations could be modified to whatever you like.

This needs cat and tee; it should work on any Mac/Linux machine.

share|improve this answer
1  
ah, very nice. This would also allow paste while in insert mode. –  gggg Jun 17 '11 at 15:47

All you really need is to use the viminfo feature. Put something like the following in your ~/.vimrc file.

set viminfo='20,\"90,h,%

Then butters, marks, and more are persisted between session automatically. See :help viminfo for more information.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.