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/clojure.vim
2016-03-03 20:43:57 +09:00

24 lines
847 B
VimL

scriptencoding utf-8
function! repl#clojure#open_repl() abort
" Setting up the file for the current file
if &modified
" Create new file temporary
let l:module_file = tempname() . '.clj'
call writefile(getline(1, expand('$')), l:module_file)
else
let l:module_file = expand('%:p')
endif
let l:repl = repl#get_filetype_repl('clojure')
let l:exec_name = split(l:repl['repl'], ' ')[0]
if !executable(l:exec_name)
call repl#echo_error(printf("You don't have repl: '%s'", l:exec_name))
return
endif
let l:args = printf('%s %s', l:repl['repl'], l:repl['opt'])
let l:vimshell_interactive = ':VimShellInteractive' . printf("--split='%s'", g:repl_split_command)
execute l:vimshell_interactive l:args
call vimshell#interactive#send(printf('(load-file "%s")', l:module_file))
endfunction