When you quit Vim, your registers' contents will be saved to a viminfo file.
See :help viminfo
for all the details.
What and how much is saved is controlled by the 'viminfo'
option, which is documented in :help 'viminfo'
.
As it happens, the default number of lines to be saved for each register is 50.
That's the item after the angle bracket: <50
.
Anything beyond that will be chopped off.
This is the documented default. You can change it by putting the following in your vimrc
:
set viminfo='100,<5000,s10,h
This will potentially result in a much bigger viminfo file.
In practice, this will be irrelevant.
Anyhow, I'd recommend a different workflow instead of relying on viminfo (which might not be available for a number of reasons).
Some alternatives:
The best solution in my opinion is to simply open two buffers in the same Vim instance.
Vim is great at managing several buffers at the same time.
Open your file1
, visual-select the text and y
.
Then, :edit file2
and p
.
You might be interested in :help clipboard-unnamed
to use the clipboard register by default for all yank/put operations.
Note, however, that you'll also need a clipboard manager for this to work on X11. A brief but very comprehensive resource on X11 clipboards is this nice article I keep putting in my answers.
You could (in theory) also save the selection as a temporary file with '<,'>:write /tmp/my_selection
and then :read /tmp/my_selection
in your second file.
This is more cumbersome than editing two buffers but there may be edge cases where this is the way to go.