Too Cool for Internet Explorer


Swobodin's Profile | Swobodin's Blog | Back to Fedora Tunisia

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.

Related posts

(sometimes, the plugin foolishes)
Malicious program
Berkeley California
The ABC’s of UNIX
Miscellaneous pictures (2)
Nautilus makes SSH easier!

Technorati tags

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

 
 

This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)

You must read and type the 5 chars within 0..9 and A..F, and submit the form.

  

Oh no, I cannot read this. Please, generate a


Top Tunisie Blogs