Monday, April 20, 2015

Re: Why command `vim -T dumb -c 'echo "Hello World!"' -c q` behaves differently when /dev/stdin is redirected from when /dev/stdin is not redirected?

On 2015-04-19, Peng Yu wrote:
> Hi,
>
> The following code runs well.
>
> vim -T dumb -c 'echo "Hello World!"' -c q
>
> ~$ cat main.sh
> #!/usr/bin/env bash
>
> cat < /dev/stdin > /dev/null
> vim -T dumb -c 'echo "Hello World!"' -c q
>
> But running the following command will show "Vim: Warning: Input is
> not from a terminal". The problem is related with /dev/stdin. Does any
> know how to understand this behavior of vim? Thanks.
>
> ~$ ./main.sh <<< xxxx

You are redirecting the script's stdin from the here string xxxx, so
that is the stdin that vim sees, which is not a terminal.

If you want vim's stdin to come from the terminal, either don't
redirect the script's stdin, or redirect vim's stdin from /dev/tty,
e.g.

vim -T dumb -c 'echo "Hello World!"' -c q < /dev/tty

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: