Thursday, October 4, 2012

Re: how to: vim -o STDIN somefile.txt

On 10/03/12 19:20, her wrote:
> how can i do this:
>
> vim -o STDIN somefile.txt
>
> what i want is something like this:
>
> $ vim -o "some text from stdin that i typed" somefilename.txt
>
> and vim would open horizontally splitted as in:
>
> some text from stdin that i typed
> -------------------------
> stuff from somefilename.txt

I was somewhat surprised that Vim doesn't seem[1] to support
multiple filenames of which one is stdin without a workaround. I'd
*expect* to be able to do something like

echo "some text from stdin" | vim -o - somefile.txt

however that gives me a

Too many edit arguments: "somefile.txt"

You can work around it with this convoluted invocation:

echo "some text from stdin" | vim -c "sp somefile.txt" -

(or "below sp somefile.txt" depending on the order you want)

-tim

[1]
my usual caveat that this is 7.2.445 on Debian Stable, and 7.3.x is
the latest and greatest; so this may no longer be the case.


--
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: