27

I was trying to copy 150 lines from a vim session to paste into another. My first thought was to go for

150Y

I did :q, then vim (otherProgram).py, and pressed 'p'. Only 50 lines copied over. So I went back to my original document and did shift-vand selected the lines I wanted then did y, went to the other document, and did p. It seemed that it did not copy over gracefully either, still only being 50 lines.

I'm starting to think that there is some default size for vim's copy buffer. I am using Mac OS X. Would there be any way to find out if there is some kind of default buffer size? Is there any way to change it?

corvid
  • 10,733
  • 11
  • 61
  • 130
  • 1
    what did you do by "went back, went to"? why you `:q`, you could `:e (otherprogram).py` – Kent Jul 23 '13 at 14:12
  • This isn't about the internal buffer size (which is limited only by available memory), but the persistence of the register contents in the _viminfo` file, because you've exited and relaunched Vim. – Ingo Karkat Jul 23 '13 at 14:25

3 Answers3

38

It looks like you need to put something like this in your .vimrc:

set viminfo='20,<1000

The important part is the <1000, which indicates that you want your registers to store up to 1000 lines each. The '20 part is apparently required when setting viminfo but is not particularly relevant for your stated needs. (It indicates that number of files for which marks are remembered.)

See :help 'vi for further details. There are plenty of additional parameters that can be specified in the viminfo string. For example, you may need to increase the maximum register size. The default is 10kb, if that isn't enough, try this to increase it to 1000kb:

set viminfo='20,<1000,s1000
pattivacek
  • 5,617
  • 5
  • 48
  • 62
5

For me this command:

set viminfo=<1000

throws an error:

E528: Must specify a ' value: viminfo=<1000

use a full string in your .vimrc file:

set viminfo='50,<1000,s100,h
  • second value - max number of lines to copy

to check your last value (in vim):

:verbose set viminfo?
Ivan Rave
  • 1,759
  • 18
  • 15
0

You are using vim's ability to keep registers in it's .viminfo between sessions. Patrick already adresses the limitation of that method and how to bump up the default limit.

But, if you need to copy/paste often between vim and other programs you should try macvim which gives you clipboard support.

Also, you should read :help buffers, vim is perfectly able to open multiple files in the same session.

FDinoff
  • 30,689
  • 5
  • 75
  • 96
romainl
  • 186,200
  • 21
  • 280
  • 313