skywind3000/asyncrun.vim

Feature: Run in a terminal, but send output to quickfix?

Opened this issue · 4 comments

The -mode=? option allows where to run the job: async (quickfix window), term, etc.

:AsyncRun -mode term make

This will open a terminal window and run the command there. It's very useful, but one thing I wish is the output of the command can be captured and sent to the quickfix window when the job finishes, and/or streamed to the quickfix window (optionally).

Such a feature would very useful to navigate and browse the command output (which will be lost when the terminal closes), like compilation error and diagnostics messages, etc.

It is possible:

:AsyncRun -mode=term -pos=TAB -post=caddf\ ~/.error.txt|copen   ls | tee ~/.error.txt

If you are using asynctasks.vim:

You can define a new task:

[make-tee]
command=ls | tee ~/.error.txt
notify=:caddf ~/.error.txt | copen
output=terminal
pos=TAB

then:

:AsyncTask make-tee

That's quite ugly -- but quite nice workaround. I think it would be quite non-trivial to stream the output from the terminal (but technically possible, see https://github.com/tpope/vim-dispatch), but first-class and seamless API would be good to have (so one can switch between different modes easily).

:AsyncRun -mode=term -pos=TAB -program=capture  ls -la

Why does it print some verbose messages like the following?

(1 of 1): [ls]
(1 of 29): [ls]
Press ENTER or type command to continue