1

When I run :make or :grep from vim on Linux I see the make/grep progress in the standard output as it occurs and then, when the command completes, I can use :copen to navigate through the quickfix list.

However, when I run either of these two commands on Windows (either from gvim or console vim), I see nothing until the command completes. Once the command completes, I can use :copen like I do on Linux, but I get no realtime output progress like I do on Linux.

Another thing different between Linux/Windows is that the make command on Windows is redirected to a temporary file, like so:

!nmake -f Make-mvc.make > C:\Users\doug\AppData\Local\Temp\VIe4397.tmp 2>&1

This appears to be the reason I get no realtime output as the command is running, but I don't know why the redirect is necessary (this does not occur on Linux) and I also don't know if there is a way to workaround the issue.

Example

Here is a demonstration of what happens when I try to build vim from source, just as an example of of using the :make command.

  1. Run the following commands from CMD.exe to checkout vim source code and start gvim:

    git clone [email protected]:vim/vim.git
    cd vim/src
    gvim -u NONE
    
  2. Run the following vim commands:

    :set makeprg=nmake
    :make -f Make_mvc.make
    
  3. You can see !nmake -f Make-mvc.make > C:\Users\doug\AppData\Local\Temp\VIe4397.tmp 2>&1 appear in the vim command line window, but no other output appears until the command completes.

    Running :make -f Make_mvc.make

1 Answer 1

1

console vim solution

From :help os_win32.txt.

Q. How do I get to see the output of ":make" while it's running?

A. Basically what you need is to put a tee program that will copy its input (the output from make) to both stdout and to the errorfile. You can find a copy of tee (and a number of other GNU tools) at
http://gnuwin32.sourceforge.net or http://unxutils.sourceforge.net
Alternatively, try the more recent Cygnus version of the GNU tools at http://www.cygwin.com Other Unix-style tools for Win32 are listed at http://directory.google.com/Top/Computers/Software/Operating_Systems/Unix/Win32/ When you do get a copy of tee, you'll need to add

:set shellpipe=\|\ tee

to your _vimrc.

gvim solution

Under gvim, a separate console window is started minimized. If you restore the minimized window, you can observe the output.

If you want the window to start restored (not minimized), then you'll have to make the following source change to src/os_win32.c and compile gvim yourself.

     si.lpDesktop = NULL;
     si.lpTitle = NULL;
     si.dwFlags = STARTF_USESHOWWINDOW;
-    /*
-     * It's nicer to run a filter command in a minimized window.
-     * Don't activate the window to keep focus on Vim.
-     */
-    if (options & SHELL_DOOUT)
-       si.wShowWindow = SW_SHOWMINNOACTIVE;
-    else
-       si.wShowWindow = SW_SHOWNORMAL;
+    si.wShowWindow = SW_SHOWNORMAL;
     si.cbReserved2 = 0;
     si.lpReserved2 = NULL;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.