Vim Tips Wiki
Advertisement
Tip 210 Printable Monobook Previous Next

created February 3, 2002 · complexity basic · author elian · version 6.0


If you use

set makeprg=gcc\ -o\ %<\ %

in your vimrc, and your actual file is file.c, then :make will compile file.c with the output file. (gcc file.c -o file).

Comments

You don't even have to make that change. Just :make %:r and you'll get the same effect.

This is true only if the default make program is actually GNU make. The tip can be applied to other compilers like Sun CC, etc.


Advertisement