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 am certain that foo.c contains more than 1000 lines.
Press V to switch to VISUAL LINE mode and then go to line 1701 by typing: 1701G . Now your lines are selected, you can run a command on them. For example, to replace foo with bar type: :s/foo/bar/ .
Pressing ctrl-g will reveal the filename, current line, the line count, your current position as a percentage, and your cursor's current column number.
Press ^ to move the cursor to the start of the current line. Press $ to move the cursor to the end of the current line.
:r! sed -n 147,227p /path/to/foo/foo.c
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With