When I use Y to yank lines, I can yank any reasonable amount of lines (I've never knowingly hit a limit). However, if I close the file and then try to paste p into another file, only the first 50 lines are pasted.

I have confirmed that only the first 50 lines of the text are found in ~/.viminfo.

How can I increase the amount of lines to store? Googling for "vimrc yank lines" and such did not return any relevant results. Additionally, how would I have found the answer in the fine manual? From trolling "h viminfo" and such I found set history but increasing the number did not help.

  • In such cases, I usually open the second file in a vsplit and paste the yanked lines :) – Nehal J Wani Sep 14 '15 at 9:15

The answer to your first question is:

set viminfo+=<100    " or whatever number you want

The answer to your second question is:

In the future, you could look over :help viminfo

The 'viminfo' option is a string containing information about what info should be stored, and contains limits on how much should be stored (see 'viminfo').

From there, <C-]> on 'viminfo' or :help 'viminfo' would have taken you directly to the relevant part of the documentation where you would have found this:

(Vi default: "", Vim default for MS-DOS, Windows and OS/2: '100,<50,s10,h,rA:,rB:,
                             for Amiga: '100,<50,s10,h,rdf0:,rdf1:,rdf2:
                             for others: '100,<50,s10,h)


<    Maximum number of lines saved for each register.  If zero then
     registers are not saved.  When not included, all lines are
     saved.  '"' is the old name for this item.
     Also see the 's' item below: limit specified in Kbyte.
  • 1
    Thank you romainl! I'm still learning to understand that manual, but at least I'm reading it. Note that neither set viminfo+=<500 nor set viminfo='100,<500,s10,h in ~/.vimrc had any effect. Even after closing and reopening vim, I still see for set viminfo? this : viminfo='100,<50,s10,h. The string viminfo does not appear anywhere else in ~/.vimrc. – dotancohen Jul 1 '14 at 10:32
  • To see what's overriding your viminfo option (the question mark is part of the command): :verbose set viminfo? – Heptite Jul 1 '14 at 20:29
  • Thank you Heptite. Other than the viminfo='100,<50,s10,h line, the only other line is Last set from ~/.vimrc. – dotancohen Jul 2 '14 at 13:44
  • 4
    This answer could be improved by removing the snarky last line. – Andrew Swift Oct 7 '14 at 11:49
  • What order are the two set viminfo lines? You have two lines it looks like.... an addition (set viminfo+=) and a set (set viminfo=) (note the +). I'm guess you have them in the wrong order. Better... Don't add (+=) values to viminfo. Set it all at once. – lornix Nov 26 '15 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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