As mentioned in other questions, using make -C buildpath as makeprg in Vim and the appropriate errorformat triggers the nice handling of the quickfix directory stack.

That is, the quickfix uses the "Enter/Leave directory" printed by make to append the right path to the detected files, so you can jump to them from the quickfix.

But it seems that it only works if make is used as single thread, i.e. -j1.
When using -jN with N > 1 then the directory stack seems to be messed in my experience, and the quickfix doesn't get the right paths.

Any idea how to solve it?

  • Welcome to Vi and Vim! While providing the links is helpful, it is even better to also include the necessary content so that your question is self-contained even if the links die. Please edit your question to that end. As far as your issue goes, fundamentally the output from parallel builds is mixed up--it's non-deterministic, even. I'm not sure of any good way to recover the correct ordering short of logging prefixes on all commands with the target they're attached too or some-such (and I'm not even sure how I would do that) – D. Ben Knoble Jun 9 at 21:10
  • Thanks for the welcome! I've updated a bit the question to make it more self-contained. And thanks to the answer from Matt I've been able to fix it using the -O option on make that keeps the terminal output of make on sync even if it uses multiple threads internally. – Albert Gil Moreno Jun 11 at 8:47

It has nothing to do with Vim, as it's your make utility who sets output order.

For GNU make read the manual.

| improve this answer | |
  • Thanks @Matt, the ‘--output-sync’ (‘-O’) option of make did the trick. – Albert Gil Moreno Jun 11 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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