vim — How to read range of lines from a file into current buffer

前端 未结 7 2140
梦毁少年i
梦毁少年i 2021-01-30 03:49

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

7条回答
  •  攒了一身酷
    2021-01-30 04:30

    The {range} refers to the destination in the current file, not the range of lines in the source file.

    After some experimentation, it seems

    :147,227r /path/to/foo/foo.c
    

    means insert the contents of /path/to/foo/foo.c after line 227 in this file. i.e.: it ignores the 147.

提交回复
热议问题