Ruby support: not to store the editing script into file and require the file, but just to eval the codes in irb in order to use local variables as well.

This commit is contained in:
ujihisa 2010-09-21 08:54:48 -07:00
parent bc382fe305
commit af4958ad8e

View File

@ -7,13 +7,15 @@ function! Repl()
endfunction endfunction
function! ReplRuby() function! ReplRuby()
let l:tmpfile = tempname() . '.rb' let l:contents = getline(0, expand('$'))
call writefile(getline(1, expand('$')), l:tmpfile, 'b') let l:args = 'irb --simple-prompt'
let l:args = 'irb --simple-prompt -r ' . l:tmpfile
call vimshell#execute_internal_command( call vimshell#execute_internal_command(
\ 'iexe', vimproc#parser#split_args(l:args), { 'stdin' : '', 'stdout' : '', 'stderr' : '' }, \ 'iexe', vimproc#parser#split_args(l:args), { 'stdin' : '', 'stdout' : '', 'stderr' : '' },
\ { 'is_interactive' : 0, 'is_single_command' : 1 }) \ { 'is_interactive' : 0, 'is_single_command' : 1 })
let b:interactive.close_immediately = 1 let b:interactive.is_close_immediately = 1
for l:line in l:contents
call vimshell#interactive#send_string(l:line . "\n")
endfor
endfunction endfunction
function! ReplHaskell() function! ReplHaskell()
@ -25,7 +27,7 @@ function! ReplHaskell()
call vimshell#execute_internal_command( call vimshell#execute_internal_command(
\ 'iexe', vimproc#parser#split_args(l:args), { 'stdin' : '', 'stdout' : '', 'stderr' : '' }, \ 'iexe', vimproc#parser#split_args(l:args), { 'stdin' : '', 'stdout' : '', 'stderr' : '' },
\ { 'is_interactive' : 0, 'is_single_command' : 1 }) \ { 'is_interactive' : 0, 'is_single_command' : 1 })
let b:interactive.close_immediately = 1 let b:interactive.is_close_immediately = 1
endfunction endfunction