then contents

This commit is contained in:
ujihisa 2010-09-21 07:28:13 -07:00
parent 1719b3ba7a
commit bc382fe305
2 changed files with 11 additions and 11 deletions

View File

@ -1,4 +1,4 @@
# quickinteractive.vim # repl.vim
Open the interactive environment with the code you are writing. Open the interactive environment with the code you are writing.
@ -14,7 +14,7 @@ You are writing the following code in an unnamed buffer.
Now you want to try running the code in an interactive environment. Usually you are supposed to (1) save the code on somewhere, (2) open a terminal, (3) run `irb -r {the-file}`. Now you want to try running the code in an interactive environment. Usually you are supposed to (1) save the code on somewhere, (2) open a terminal, (3) run `irb -r {the-file}`.
If you already installed quickinteractive.vim, you just have to run `:QuickInteractive` or to type `<space>i`. It opens a buffer that is the environment you wanted. If you already installed quickinteractive.vim, you just have to run `:Repl` or to type `<space>i`. It opens a buffer that is the environment you wanted.
irb> irb>
@ -31,13 +31,13 @@ You can do
test1 = TestCase (assertEqual "for (foo 3)," (1,2) (foo 3)) test1 = TestCase (assertEqual "for (foo 3)," (1,2) (foo 3))
tests = TestList [TestLabel "test1" test1] tests = TestList [TestLabel "test1" test1]
Run `:QuickInteractive` without saving the code on a file. Run `:Repl` without saving the code on a file.
ghci> runTestTT tests ghci> runTestTT tests
## Installation ## Installation
$ jolt install quickinteractive $ jolt install repl.vim
will be available soon. will be available soon.

View File

@ -1,12 +1,12 @@
function! QuickInteractive() function! Repl()
if &filetype == 'ruby' if &filetype == 'ruby'
call QuickInteractiveRuby() call ReplRuby()
elseif &filetype == 'haskell' elseif &filetype == 'haskell'
call QuickInteractiveHaskell() call ReplHaskell()
endif endif
endfunction endfunction
function! QuickInteractiveRuby() function! ReplRuby()
let l:tmpfile = tempname() . '.rb' let l:tmpfile = tempname() . '.rb'
call writefile(getline(1, expand('$')), l:tmpfile, 'b') call writefile(getline(1, expand('$')), l:tmpfile, 'b')
let l:args = 'irb --simple-prompt -r ' . l:tmpfile let l:args = 'irb --simple-prompt -r ' . l:tmpfile
@ -16,7 +16,7 @@ function! QuickInteractiveRuby()
let b:interactive.close_immediately = 1 let b:interactive.close_immediately = 1
endfunction endfunction
function! QuickInteractiveHaskell() function! ReplHaskell()
let l:tmpfile = tempname() . '.hs' let l:tmpfile = tempname() . '.hs'
let l:tmpobj = tempname() . '.o' let l:tmpobj = tempname() . '.o'
call writefile(getline(1, expand('$')), l:tmpfile, 'b') call writefile(getline(1, expand('$')), l:tmpfile, 'b')
@ -29,5 +29,5 @@ function! QuickInteractiveHaskell()
endfunction endfunction
command! -nargs=0 QuickInteractive call QuickInteractive() command! -nargs=0 Repl call Repl()
nnoremap <Space>i :<C-u>QuickInteractive<Cr> nnoremap <Space>i :<C-u>Repl<Cr>