I'd like to append a custom string at the end of the file.

For example using :read command this works:

:$r !echo my string

however is there any more portable way of doing that (without executing external program)?

I've tried:

:$r "my string"

but it's just duplicating content of my file (the same as: :$r %).

How to I specify literal string in this context?

  • 1
    :call append('$', 'my string') - not using a replace command though. And by the way, :r is read, rather than replace. – Sato Katsura Oct 17 '15 at 12:56
  • @SatoKatsura You're right, I've corrected the title. I think I got confused by: :help r. – kenorb Oct 17 '15 at 17:01

Yes, you can use :put:

:$put='my string'

See :help :put.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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