Compile and run cpp program from Vim
March 27, 2014
To compile and run cpp program from
MVIM(or VIM) directly. Add this to
Note: You can remove/add the
<Enter> if you prefer to press
Now simply hit
Ctrl + c to compile and
Ctrl + x to execute.
For a source file with name
main.cpp, commands will be expanded to
%:r gets the current filename without the extension whereas
gets the current filename.
You can very easily extend above approach to compile using makefile.