From af4958ad8ebe5af1ee9e05b8e58ec6932cc04f07 Mon Sep 17 00:00:00 2001 From: ujihisa Date: Tue, 21 Sep 2010 08:54:48 -0700 Subject: [PATCH] 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. --- plugin/repl.vim | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugin/repl.vim b/plugin/repl.vim index 85aa4f6..5824f03 100644 --- a/plugin/repl.vim +++ b/plugin/repl.vim @@ -7,13 +7,15 @@ function! Repl() endfunction function! ReplRuby() - let l:tmpfile = tempname() . '.rb' - call writefile(getline(1, expand('$')), l:tmpfile, 'b') - let l:args = 'irb --simple-prompt -r ' . l:tmpfile + let l:contents = getline(0, expand('$')) + let l:args = 'irb --simple-prompt' 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.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 function! ReplHaskell() @@ -25,7 +27,7 @@ function! ReplHaskell() 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.close_immediately = 1 + let b:interactive.is_close_immediately = 1 endfunction