This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
repl.vim/autoload/repl/haskell.vim
2015-12-20 19:53:58 +09:00

22 lines
747 B
VimL

scriptencoding utf-8
function! repl#haskell#open_repl() abort
" Setting up the file for the current file
if &modified
" Create new file temporary
let l:module_file = tempname() . '.hs'
call writefile(getline(1, expand('$')), l:module_file)
else
let l:module_file = expand('%:p')
endif
let l:repl = get(g:, 'repl_filetype_repl.haskell.repl', g:repl#default_filetype_repl.haskell['repl'])
let l:opt = get(g:, 'repl_filetype_repl.haskell.opt', g:repl#default_filetype_repl.haskell['opt'])
if !executable(l:repl)
call repl#echo_error(printf("You don't have repl: '%s'", l:repl))
return
endif
let l:args = printf('%s %s %s', l:repl, l:opt, l:module_file)
execute ':VimShellInteractive' l:args
endfunction