Skip to content

Commit

Permalink
Merge pull request #1 from roman/master
Browse files Browse the repository at this point in the history
Adding Python support
  • Loading branch information
ujihisa committed Jun 4, 2011
2 parents a087636 + 54cf2d9 commit c4bec32
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion plugin/repl.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ function! Repl()
call ReplHaskell()
elseif &filetype == 'erlang'
call ReplErlang()
elseif &filetype == 'python'
call ReplPython()
elseif &filetype == 'scala'
call ReplScala()
endif
endfunction

Expand Down Expand Up @@ -48,7 +52,24 @@ 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


function! ReplScala()
let l:currentFile = expand('%')
let l:args = 'scala -i ' . l:currentFile
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
endfunction

command! -nargs=0 Repl call Repl()
nnoremap <Space>i :<C-u>Repl<Cr>

0 comments on commit c4bec32

Please sign in to comment.