How to make Vim Quickfix show errors in source files instead of the make file

StackOverflow https://stackoverflow.com/questions/22421039

  •  15-06-2023
  •  | 
  •  

Question

So I am programming in C with VIM by using the make command to compile my code.
I would like to use the quickfix plugin to quickly move to the different compile errors but the only error that quickfix shows is the failed command in the make file.

I have failed to find any clues on google for this problem, is there something I could be missing to make this work?

Était-ce utile?

La solution 2

I have finally solved the problem.

It turns out that if your shell is set to use FISH the output of the make command displays correctly but for some reason quickfix is unable to pick up any errors except for the failed part in the make file.

I solved the problem by switching vim to use bash instead by adding set shell=/usr/bin/bash to my .vimrc file.

Autres conseils

The quickfix list (it's built in, not a plugin) parses the output of :make according to the rules in the 'errorformat' option, in order to extract file names, line numbers, and error messages.

Usually, you don't write those yourself, but you simply choose the appropriate compiler plugin. If your build uses GCC, you can set the compiler by

:compiler gcc

See :help compiler for details and a list of compiler plugins that ship with Vim.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top