vim redirect output to quickfix

tawheed picture tawheed · Aug 8, 2013 · Viewed 7.8k times · Source

Is it possible to redirect an output of a command to the quick fix window?

The command I am running is

:!java %:r

and was hoping the output would go into the quickfix window

Answer

Ingo Karkat picture Ingo Karkat · Aug 8, 2013

Please note that the quickfix window is for specific output (e.g. of compiler or syntax checker tools) which includes references (i.e. line and column numbers) to the current buffer. There's a lot of infrastructure around this: 'makeprg', 'errorformat', etc., usually bundled into a compiler plugin.

Though you can redirect arbitrary output into the quickfix window, it provides little benefit (and has the downside of clobbering 'makeprg') over reading the output of an external program into a new scratch buffer, e.g. like this:

:new|0read !java #:r