I want to read line n1->n2 from file foo.c into the current buffer.
I tried: 147,227r /path/to/foo/foo.c
But I get: \"E16: Invalid range\", though I
I just had to do this in a code project of mine and did it this way:
In buffer with /path/to/foo/foo.c
open:
:147,227w export.txt
In buffer I'm working with:
:r export.txt
Much easier in my book... It requires having both files open, but if I'm importing a set of lines, I usually have them both open anyway. This method is more general and easier to remember for me, especially if I'm trying to export/import a trickier set of lines using g/
or some other more complicated way of selecting lines.