Thursday, October 17, 2013

Re: capture output of a vim command into a quickfix windows without freezing vim

On 2013-10-17, FlashBurn wrote:
> My colleague at work is using Emacs and it I recently saw a really
> nice feature that he is using. Whenever he compiles his code the
> output is dumped into a scratch buffer in what I would call "live"
> mode. Meaning he can edit files while the code is being compiled.
> I was wondering if it is possible to do something like this in
> Vim.
>
> I have mapped my make and setup my quickfix window to work with
> it. However whenever I execute make, I have to wait till it
> finishes. Is there a way in Vim to execute make, see make target
> execution as if it is being executed in a shell, capture the
> output, and then navigate this output?
>
> Any help is appreciated.

Vim is not multi-threaded, and it has only one command line, so you
can't run a command in the foreground of one window while editing in
another window.

I looked at ":help remote.txt" but didn't see anything there that
would do what you want, but I don't use the client-server
functionality so I could easily be wrong about that.

The easiest "solution" is to run your make command in a different
Vim instance.

Another approach is to run make in the background and send its
output to file. Then, when that make is done, you can use :cfile
command to open that file in a quickfix window.

To know when your background make is done, you can have it echo a
message to its stdout, stderr or /dev/tty, which unfortunately
messes up your display, or you can use a Unix command such as
xmessage to display a message in an X window. One nice thing about
using xmessage is that you can be working in a different workspace
from the one in which you ran make and still be informed when make
is done.

HTH,
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/groups/opt_out.

No comments: