From 97fd93c42c8ca3d5a6561d1b8ae5c7b2f536a588 Mon Sep 17 00:00:00 2001 From: Roman Gonzalez Date: Fri, 3 Jun 2011 18:12:27 -0700 Subject: [PATCH] Adding support for Python \o/ --- plugin/repl.vim | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plugin/repl.vim b/plugin/repl.vim index 9b10aaa..0c11349 100644 --- a/plugin/repl.vim +++ b/plugin/repl.vim @@ -5,6 +5,8 @@ function! Repl() call ReplHaskell() elseif &filetype == 'erlang' call ReplErlang() + elseif &filetype == 'python' + call ReplPython() endif endfunction @@ -48,7 +50,15 @@ function! ReplErlang() call vimshell#interactive#send_string(printf("c('%s').\n", l:tmppath)) endfunction - - +function! ReplPython() + let l:currentFile = expand('%:r') " current file without the extension + let l:args = 'python -' + call vimshell#execute_internal_command( + \ 'iexe', vimproc#parser#split_args(l:args), { 'stdin': '', 'stdout': '', 'stderr': '' }, + \ { 'is_interactive' : 0, 'is_single_command' : 1 }) + let b:interactive.is_close_immediately = 1 + call vimshell#interactive#send_string("from " . l:currentFile . " import *\n") +endfunction + command! -nargs=0 Repl call Repl() nnoremap i :Repl