If I am in the middle of the buffer and want to append external file data to the current buffer. So far I move to end of the file with G and reading the data :r file so it is doing the work ...... Is there any standard style of vim reading

  • "Is there any standard style of vim reading" What do you mean?
    – romainl
    Sep 6, 2016 at 11:41

1 Answer 1


Are you looking for :$r file? -- which will move the cursor. Don't forget to play with marks I often use mx to mark and 'x to come back.

You can also use: :call append('$', readfile('file')) -- which won't move the cursor. This is what we prefer to use when writing scripts nowadays.

  • 2
    Note that the $ is nothing special here; :read will accept any range, so something like inserting a text file in line 42 also works: :42read file. See :help :read and :help :range. Sep 6, 2016 at 12:10
  • @Luc Hermitte Thanks for the quick reply and good explanation of answer
    – Ankanna
    Sep 6, 2016 at 12:19
  • @Carpetsmoker Thanks for extending the answer to +1 level up
    – Ankanna
    Sep 6, 2016 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.