From 782450c744cc57be0b326c01c08f16ced37c5821 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Tue, 10 Jun 2014 01:24:30 +0400 Subject: [PATCH] python is added to cf5. --- vim/cf5-compiler.vim | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/vim/cf5-compiler.vim b/vim/cf5-compiler.vim index 5fb47f4..0bc5f64 100755 --- a/vim/cf5-compiler.vim +++ b/vim/cf5-compiler.vim @@ -58,6 +58,24 @@ function! s:CompileJava(run) "{{{2 echo eout endfunction +function! s:InterpretPython(run) "{{{2 + " Interpret it + let cmd = "python " . g:pyflags . " " . expand("%") + echo cmd + let cout = system( cmd ) + echo cout + if v:shell_error + return + endif + " run it + "let classpath=expand("%:p:r") + "let exename=expand("%:r") + "let cmd = "java " . exename . " " . g:argv + "echo cmd + "let eout = system( cmd ) + "echo eout +endfunction + function! s:CompileWindows(run) "{{{2 let ext=expand("%:e") if ext=="java" @@ -66,6 +84,12 @@ function! s:CompileWindows(run) "{{{2 if ext=="cpp" call s:CompileMSVC(a:run) endif + if ext=="c" + call s:CompileMSVC(a:run) + endif + if ext=="py" + call s:InterpretPython(a:run) + endif endfunction " @@ -93,7 +117,19 @@ function! s:CompileGCC(run) "{{{2 endfunction function! s:CompileLinux(run) "{{{2 - call s:CompileGCC(a:run) + let ext=expand("%:e") + if ext=="java" + call s:CompileJava(a:run) + endif + if ext=="cpp" + call s:CompileGCC(a:run) + endif + if ext=="c" + call s:CompileGCC(a:run) + endif + if ext=="py" + call s:InterpretPython(a:run) + endif endfunction " @@ -154,6 +190,7 @@ endfunction function! s:initDefaults() let g:cf5output=0 let g:argv="" + let g:pyflags="" let g:cppflags="" let g:wcppflags="/O2 /EHsc /DWIN32" let g:lcppflags="-O2"