views:

1075

answers:

4

I use gVim in windows to edit my code (mostly C++). I use :make in gVim to compile the project, but this is a blocking operation, that prevents me from using gVim until the compilation is complete. How can I do :make asynchronously and still get the benefits of reading the errors back into Vim and jump to the errors in source code? Bonus points if I get to see the make process in real time. Right now the :make redirects the output into a file, hence I get to see the progress of make.

+10  A: 

What I do is

:!gvim -c 'MyMake'

( where MyMake is the custom command which can switch to appropriate dir, make, and copen 20. )

and I am doing my job while build goes in the other window.

Other option:
You can redirect make progress to some file from the shell or within vim (:!make&). And then by using

:cfile make_result_file

:cw
 or
:copen 20

Achieve the same result as you'd use :make

Mykola Golubyev
A: 

I would use your OS's inbuilt methods for running background tasks.

On windows, try typing

:!start make

On linux / mac os x, try

:!make > /dev/null 2>&1 &
gar
:!start make works fine if you are just trying to spawn a make process. I am looking to use the in build feature of gvim where it reads the errors into vim and you can jump to the error in source code by double clicking on it.
jinxed_coder
A: 

Try using

:!start make

(more info on ":help !start") - that way vim doesn't have to wait for the process started to finish - you can just keep on going with your editing).

ldigas
:!start make works fine if you are just trying to spawn a make process. I am looking to use the in build feature of gvim where it reads the errors into vim and you can jump to the error in source code by double clicking on it.
jinxed_coder
A: 

You won't be able to see the progress of make.

And as you run on windows, you'll have to check Marc Weber plugin to do background compilation -- mine (BuildToolsWrapper works only under *nix)

Luc Hermitte