When I set makeprg using:set makeprg=gcc\ -Wall\ -g\ %\ -o\ %and then invoke :make Vim does not pass proper filenames, because this command is translated as:gcc -Wall -g file.c -o file.cand executed. The compiler is then complaining that input and output files are the same, which is in fact dangerous. My question is how to change the second % in makeprg to have it without .c extension. The command exectuted should be like this:gcc -Wall -g file.c -o fileI don't know what to put instead the second %.
How to customize % symbol in makeprg command
command line;replace;makeprg
Unless you're using a non-properly configured version of gnumake (Solaris OS, or mingw distribution of gcc under windows), you don't need to modify &makeprg. Its default value is already perfect for GNU compilation tools.All you need to do is to set $CFLAGS with :let $CFLAGS=-g -Wall, and compile with :make %<.