On Linux, editing file_B
in vim I want to add line 10-25 from file_A
. Example: One has a whole set of HTML-Documents with quite the same header and yes, one could create a template and start from there, but still:
I am looking for a simple [and elegant] way to insert a range of lines from one file and add it to the file I am currently editing. In vim.
The solutions I found so far but are not exactly what I'm looking for, are
- inside
file_B
the command:read file_A
will add *the whole file_A* into file_B. Too much - there is copy&paste inside vim – but for this one must have opened
file_A
- inside file_A
:10,25w! file_B
will 'send' the given range of lines tofile_B
.
This seems quite close to copy&paste - one can open multiple windows in vim
But as I work on an 8inch screen, multiple windows make orientation hard
As I wasn't able to find a comfortable solution I wonder if I just misunderstood something or the ways I found so far are commonly used and taken as the standard way.
vim
. But this seems out of reach. And I really wonder if this only achievable through outside commands, because as far as I got withvim
now, I came to little restrictions up to here.