1

My question could fairly be a duplicate of this, but I hope I'm making it critically different by asking about :makeing Vim itself and having a meaningful quickfix window. (In reality, my use case is that of building my codebase, but if I can't get :make doing the right thing for Vim, what's the point of wandering?)


I would have expected that running :make in Vim's repo would result in an empty quickfix window (no errors, as no errors, is what I get if I compile in the terminal via make).

But instead, it looks like the qf is populated with several lines of the output, even if none of them represents an error. In the screencast below, indeed, I use :cnext to move from "error" 1 of 16 (at time 00:10) to 16 of 16 (at time 00:28) and they all look like a piece of the output, e.g.

(11 of 16): make[2]: Nothing to be done for 'first'.

So the first part of the question is why does :make populate the qf window with non-error-nor-warning items?


When there is indeed a compilation error (e.g. in the screencast below, at time 00:40, I've removed a { of the AutoPatCmd_S struct, thus making the file erroneous, and run :make again, at time 00:44), :cnext eventually brings me in an object file (at time 1:15 onward), which I also suspect is not particularly useful.

What settings do I need to make Vim do the right thing as far as the qf for errors of :make is concerned?

asciicast

5
  • I'm on HEAD and I get no error. Besides, if :help 'makeprg' is set to make, then there is no intrinsic difference between being called via :make, :!make, or $ make. There can be some extrinsic differences like environment variables or aliases but that's all. It's just make.
    – romainl
    Mar 11, 2023 at 8:00
  • @romainl, sorry for the confusion, but what I meant is that I edited the file to cause an error. As you can see in the screencast.
    – Enlico
    Mar 11, 2023 at 8:02
  • I can't see anything in the screencast. It is too fast and lacks all kinds of context cues.
    – romainl
    Mar 11, 2023 at 8:03
  • @romainl, I've tried to improve the question.
    – Enlico
    Mar 11, 2023 at 8:23
  • 1
    That is one of the cases that lead me to create vim-shout recently: asciinema.org/a/Mw5VpaDHJ0Ifk71bAWD7Er5Ak
    – Maxim Kim
    Mar 11, 2023 at 8:30

1 Answer 1

3

:make executes :help 'makeprg', grabs its output, parses it with :help 'errorformat', and then populates the quickfix list with "valid" errors, eg stuff that passed the parsing phase.

One problem, here, is that make is run from the root of the project, which means that it is the root Makefile that is used, which means that it will output lots of ultimately useless "Entering/Leaving directory XXX" messages that will pollute your quickfix list, as well as non-existing paths and so on.

With src as working directory, make uses src/Makefile, which results in a usable quickfix list/window.

make

2
  • I don't get an exactly identical qf. I guess it is a GCC vs Clang difference?
    – Enlico
    Mar 11, 2023 at 11:59
  • That's a possibility, yes.
    – romainl
    Mar 11, 2023 at 12:00

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.