Develop C with vim

OS:Ubuntu12.04
Vim version:7.3



Abstract:
fast compile c program with vim by set makeprg; fast run C program by map!.


Basics:
type vimtutor in shell to get the basic command in vim
:help makeprg
:help map


Key:
set makeprg to fast compile C, append the following lines in ~/.vimrc

"compile with make, -lm when necessary "
set makeprg=gcc\ -ansi\ -Wall\ -o\ %\ $*
" run c program with run "
map! run !./%<
 
Others:

Ctrl-n - complete (a small popup should appear. You can browse this with
              Ctrl-n and Ctrl-p. Simply continue typing when done.

" run c program with run "
" % is current file name"
" %< is current file name without suffix "
map! run !./%<
 
Reference:

猜你喜欢

转载自lingceng.iteye.com/blog/1545565