John Beckett wrote:
> Aman Jain wrote:
>> I want to read line n1->n2 from file foo.c into current buffer
>> I tried :147,227r /path/to/foo/foo.c
> 
> The ':read' command reads a whole file into the current buffer, below the 
> specified
> range (after line 227 in the current buffer).
> 
> You could use some external tool which reads the wanted lines and outputs 
> them to
> stdout (see ':help :r!').

Just to have it in the thread, if you've got sed in your path 
(available on all *nix boxes):

   :r! sed -n '147,227p'

This also works nicely if it's a humongous file that would bring 
Vim to its knees, but you only want a known slice, sed streams 
the file so it may take a while, but it won't kill your system/vim.

-tim





--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to