Vim + GCC
A friend of mine, Hussemus (Homo codigus C plus plus) asked me how to integrate gcc into Vim to compile and run applications, like in Borland’s C++.
I made a search at Vim Website (search query: gcc) and found this interesting tip. You have to add these lines in your ~/.vimrc file:
map <F5> :call CompileRunGcc()<CR>
map <F8> : call CompileGcc()<CR>
func! CompileRunGcc()
exec "w" "Save the file
exec "!gcc % -o %< && cr 10 && IF EXIST %<.exe (%<) ELSE banner -c = Compile unsuccessful "
exec "i" "jump back where we were
endfunc
func! CompileGcc()
exec "w"
exec "!gcc % -o %< && IF EXIST %<.exe (cr 5 && banner -c # Success) ELSE banner -c # Compile Unsuccessful "
exec "i"
endfunc
Now, type F8 to compile or F5 to compile and run the program.
