supporting erlang :D
This commit is contained in:
parent
af4958ad8e
commit
a08763699c
@ -35,6 +35,12 @@ Run `:Repl` without saving the code on a file.
|
|||||||
|
|
||||||
ghci> runTestTT tests
|
ghci> runTestTT tests
|
||||||
|
|
||||||
|
## Supports
|
||||||
|
|
||||||
|
* Ruby
|
||||||
|
* Haskell
|
||||||
|
* Erlang
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
$ jolt install repl.vim
|
$ jolt install repl.vim
|
||||||
|
@ -3,6 +3,8 @@ function! Repl()
|
|||||||
call ReplRuby()
|
call ReplRuby()
|
||||||
elseif &filetype == 'haskell'
|
elseif &filetype == 'haskell'
|
||||||
call ReplHaskell()
|
call ReplHaskell()
|
||||||
|
elseif &filetype == 'erlang'
|
||||||
|
call ReplErlang()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -30,6 +32,23 @@ function! ReplHaskell()
|
|||||||
let b:interactive.is_close_immediately = 1
|
let b:interactive.is_close_immediately = 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! ReplErlang()
|
||||||
|
" FIXME: this function messes current directly with a .bean file.
|
||||||
|
let l:modulename = get(matchlist(join(getline(1, line('$'))), '-module(\(.\{-}\))\.'), 1, "ujihisa")
|
||||||
|
let l:tmppath = substitute(tempname(), "[^/]*$", l:modulename, '')
|
||||||
|
let l:tmpfile = l:tmppath . '.erl'
|
||||||
|
"let l:tmpobj = tempname() . '.o'
|
||||||
|
call writefile(getline(1, expand('$')), l:tmpfile, 'b')
|
||||||
|
"call vimproc#system('ghc ' . l:tmpfile . ' -o ' . l:tmpobj)
|
||||||
|
let l:args = 'erl'
|
||||||
|
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(printf("c('%s').\n", l:tmppath))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
command! -nargs=0 Repl call Repl()
|
command! -nargs=0 Repl call Repl()
|
||||||
nnoremap <Space>i :<C-u>Repl<Cr>
|
nnoremap <Space>i :<C-u>Repl<Cr>
|
||||||
|
Reference in New Issue
Block a user