Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to pass arbitrary text to Vim?

Tags:

vim

I want a way to pass some literal text to Vim. I've seen that it can read from stdin with the "-" argument, so you can pipe things to it, e.g. the output of other commands.

But is there a way to pass any text into it like

vim - "Here's some random text"

and open Vim with that string in the buffer?

It complains if I try this command...

like image 380
Adam Neal Avatar asked Sep 11 '09 19:09

Adam Neal


2 Answers

$ echo "Here's some random text" | vim -
like image 175
Eimantas Avatar answered Sep 30 '22 10:09

Eimantas


echo string | vim -
like image 39
mmx Avatar answered Sep 30 '22 10:09

mmx