Support Erlang (erl)
This commit is contained in:
parent
960e71e83e
commit
a69d896f9b
@ -40,9 +40,6 @@ Run `:Repl` without saving the code on a file.
|
|||||||
* Ruby
|
* Ruby
|
||||||
* Haskell
|
* Haskell
|
||||||
* Python (You can chose python2 or python3 interpreter)
|
* Python (You can chose python2 or python3 interpreter)
|
||||||
|
|
||||||
## TODO
|
|
||||||
|
|
||||||
* Erlang
|
* Erlang
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
@ -24,8 +24,7 @@ function! repl#run_repl()
|
|||||||
elseif &filetype ==# 'haskell'
|
elseif &filetype ==# 'haskell'
|
||||||
call repl#start_haskell()
|
call repl#start_haskell()
|
||||||
elseif &filetype ==# 'erlang'
|
elseif &filetype ==# 'erlang'
|
||||||
call s:sorry()
|
call repl#start_erlang()
|
||||||
"call ReplErlang()
|
|
||||||
elseif &filetype ==# 'python'
|
elseif &filetype ==# 'python'
|
||||||
call repl#start_python()
|
call repl#start_python()
|
||||||
elseif &filetype ==# 'scala'
|
elseif &filetype ==# 'scala'
|
||||||
@ -95,21 +94,30 @@ function! repl#start_python()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
"function! ReplErlang()
|
function! repl#start_erlang()
|
||||||
" " FIXME: this function messes current directly with a .bean file.
|
" FIXME: this function messes current directly with a .bean file.
|
||||||
" let l:modulename = get(matchlist(join(getline(1, line('$'))), '-module(\(.\{-}\))\.'), 1, "ujihisa")
|
" Setting up the file for the current file
|
||||||
" let l:tmppath = substitute(tempname(), "[^/]*$", l:modulename, '')
|
if &modified
|
||||||
" let l:tmpfile = l:tmppath . '.erl'
|
" Create new file temporary
|
||||||
" "let l:tmpobj = tempname() . '.o'
|
let l:module_file = tempname() . '.erl'
|
||||||
" call writefile(getline(1, expand('$')), l:tmpfile, 'b')
|
call writefile(getline(1, expand('$')), l:module_file)
|
||||||
" "call vimproc#system('ghc ' . l:tmpfile . ' -o ' . l:tmpobj)
|
else
|
||||||
" let l:args = 'erl'
|
let l:module_file = expand('%:p')
|
||||||
" call vimshell#execute_internal_command(
|
endif
|
||||||
" \ 'iexe', vimproc#parser#split_args(l:args), { 'stdin' : '', 'stdout' : '', 'stderr' : '' },
|
|
||||||
" \ { 'is_interactive' : 0, 'is_single_command' : 1 })
|
let l:repl = exists('g:repl_filetype_repl.erlang') ? g:repl_filetype_repl.erlang['repl']
|
||||||
" let b:interactive.is_close_immediately = 1
|
\ : g:repl#default_filetype_repl.erlang['repl']
|
||||||
" call vimshell#interactive#send_string(printf("c('%s').\n", l:tmppath), 1)
|
let l:opt = exists('g:repl_filetype_repl.erlang') ? g:repl_filetype_repl.erlang['opt']
|
||||||
"endfunction
|
\ : g:repl#default_filetype_repl.erlang['opt']
|
||||||
|
let l:args = printf('%s %s %s', l:repl, l:opt, l:module_file)
|
||||||
|
|
||||||
|
" Change current directory temporary
|
||||||
|
let l:pwd = getcwd()
|
||||||
|
cd %:p:h
|
||||||
|
execute ':VimShellInteractive' l:args
|
||||||
|
call vimshell#interactive#send(printf('c(%s).', fnamemodify(l:module_file, ':t:r')))
|
||||||
|
execute 'cd' l:pwd
|
||||||
|
endfunction
|
||||||
|
|
||||||
"function! ReplScala()
|
"function! ReplScala()
|
||||||
" let l:currentFile = expand('%')
|
" let l:currentFile = expand('%')
|
||||||
|
@ -19,6 +19,10 @@ let g:repl#default_filetype_repl = get(g:, 'repl_filetype_repl', {
|
|||||||
\ 'python' : {
|
\ 'python' : {
|
||||||
\ 'repl' : 'python',
|
\ 'repl' : 'python',
|
||||||
\ 'opt' : '-i'
|
\ 'opt' : '-i'
|
||||||
|
\ },
|
||||||
|
\ 'erlang' : {
|
||||||
|
\ 'repl' : 'erl',
|
||||||
|
\ 'opt' : ''
|
||||||
\ }
|
\ }
|
||||||
\})
|
\})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user