Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wookayin opened this issue Oct 30, 2022 · 4 comments
Open

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

wookayin opened this issue Oct 30, 2022 · 4 comments

Comments

@wookayin
Copy link
Contributor

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.

@skywind3000
Copy link
Owner

skywind3000 commented Oct 31, 2022

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

@wookayin
Copy link
Contributor Author

wookayin commented Nov 1, 2022

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).

@skywind3000
Copy link
Owner

skywind3000 commented Nov 2, 2022

@wookayin
Copy link
Contributor Author

wookayin commented Nov 5, 2022

: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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants