Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quickfix list in vim when working with ninja and clang++

I have a C++ project which I compile using ninja and clang++, and would like to have errors during compilation appear in the quickfix list. Currently, when I set makeprg=ninja, and then run :make, all of the output generated by ninja simply appears in the quickfix window, and cannot be used to jump to the corresponding files/lines etc.

I am NOT looking for the functionality given by syntastic (which I am already using), but I also want to see errors from other files in the project, similar to what IDEs provide.

If this cannot (easily) be done with ninja, solutions using make are also welcome(the project uses cmake, so both are possible), but I would like to stay with ninja, if possible.

like image 421
Futile Avatar asked Dec 15 '13 21:12

Futile


1 Answers

all of the output generated by ninja simply appears in the quickfix window, and cannot be used to jump

That sounds like Vim cannot parse the location information out of the errors because the appropriate 'errorformat' hasn't been set.

Search around, maybe someone has already written such. Otherwise, you need to write your own compiler plugin, and then use :compiler ninja instead of :set makeprg=ninja. See :help write-compiler-plugin.

like image 129
Ingo Karkat Avatar answered Oct 17 '22 15:10

Ingo Karkat