Sunday, April 24, 2011

Re: Vim: Warning: Input is not from a terminal

On 2011-04-24, Joan Miquel Torres Rigo wrote:
> 2011/4/22 Gary Johnson <garyjohn@spocom.com>:
> >
> > The point is that there is no functional reason that Vim has to use
> > "-" to mean that its buffer contents are coming from stdin.  My
> > guess is that Vim's use of "-" is another quirk resulting from its
> > historical connections to vi, ex and ed.
>
> Then, how could you do something like this if stdin is always threated
> as input file?:
>
> echo ":wq"|vim foo.txt
>
> Quite unuseful, ok. But we could add much more commands to the input stream.

I was not suggesting that stdin always be treated as an input file.
I was suggesting that the current means used to specify whether
stdin is treated as a data file or as a command stream is not the
only way it could have been done. For example, when stdin is not
connected to a terminal, Vim could assume that stdin should be
treated as a data file and could require a flag to specify that
stdin should be treated as a command stream.

I am also not suggesting that the current behavior be changed.
While it is not consistent with some other programs such as less,
and can be frustrating when I forget the '-', the current behavior
is reasonable, and I am getting better at remembering the '-'.

> Well, this is not the "normal" use of vim. But is it "echo something |
> vim -" as well?

I frequently pipe the output of some command into Vim to use Vim as
a pager, or to use the command output as the start of a new file, or
to edit and then execute some part of the command output.

Regards,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment