Reputation: 2225
When using vim, I would like to use a custom command to build my projects.
The build command looks as following
matmake2 -t gcc-debug
Optimally I would like to use vims built in error buffer, so that I could use :copen
to view and navigate the errors, but the results from running
:!matmake2 -t gcc-debug
is not picked up by vims error parser, and when trying to set
set makeprg='matmake2 -t gcc-debug'
in my vimrc-file, I get the error "Unknown flag -t".
Is there any way so that I can run my custom build command with arguments in a way so that vims error parser will pick it up?
Upvotes: 1
Views: 555
Reputation: 196546
The errors picked up by Vim end up in the quickfix list. There are many commands that can populate that list but :!<whatever>
is not one of them.
What you need is the :help :make
command, which calls the program defined with :help 'makeprg'
, parses its output against the various patterns in :help 'errorformat'
, and populates the :help quickfix
list with valid errors.
You were on the right track with:
set makeprg='matmake2 -t gcc-debug'
but string options don't take expressions as value. You can set makeprg
this way:
set makeprg=matmake2\ -t\ gcc-debug
or that way:
let &makeprg = 'matmake2 -t gcc-debug'
with either of the two lines above in your config, you should be able to do :make %
and then :copen
to see your errors.
Upvotes: 1