程序在win下运行没有错误。。。没有试过gcc环境的编译。。。
程序代码: "定义CompileRun函数,用来调用编译和运行
func CompileRun()
exec "w"
if &filetype == 'c'
exec "!gcc % -g -o %<.exe"
elseif &filetype == 'cpp'
exec "!g++ % -g -o %<.exe"
elseif &filetype == 'java'
exec "!javac %"
endif
endfunc
"结束定义ComplieRun
"定义Run函数
func Run()
if &filetype == 'c' || &filetype == 'cpp'
exec "!%<.exe"
elseif &filetype == 'java'
exec "!java %<"
endif
endfunc
"定义Debug函数,用来调试程序
func Debug()
exec "w"
if &filetype == 'c'
exec "!gcc % -g -o %<.exe"
exec "!gdb %<.exe"
elseif &filetype == 'cpp'
exec "!g++ % -g -o %<.exe"
exec "!gdb %<.exe"
elseif &filetype == 'java'
exec "!javac %"
exec "!jdb %<"
endif
endfunc
"设置程序的运行和调试的快捷键F5和Ctrl-F5
map <F5> :call CompileRun()<CR>
map <F6> :call Run()<CR>
map <C-F5> :call Debug()<CR>