Hacker News new | ask | show | jobs
by CGamesPlay 842 days ago
I think this is more designed for streamed output rather than viewing files. Vim doesn't seem to support that, in fact it just says "Vim: Reading from stdin..." forever.
3 comments

Hmm.. I guess you could write a little script (2 lines?), let's call it "vimlive" which reads from stdin, streams to a temp file and opens that temp file in vim.

Then with:

    command | vimlive
You get vim with the current state of the data and you can update it with :e
You can have vim constantly refresh a buffer if it's modified externally, like this turns your buffer into a kinda-sorta-version of `tail -f`:

    :set autoread | au CursorHold * checktime | call feedkeys("G")
So if it's already a file, just open it with vim; if it's a STDOUT/STDERR stream, redirect/`tee` to a file and open that.
Also it’s not as snappy when you cross the 1GB limit, although it does work, mostly.
With a quick look at the code I'm pretty sure this WebUI also wouldn't be snappy along before that.
try

    vim filename 
lmao