From 1000a637d84c15ed1487afe325b78b85a1911f51 Mon Sep 17 00:00:00 2001 From: s-zeng Date: Sat, 9 Sep 2017 22:47:55 -0400 Subject: [PATCH] Fixed racket support for real --- autoload/repl.vim | 2 ++ autoload/repl/scheme.vim | 21 +++++++++++++++++++++ plugin/repl.vim | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 autoload/repl/scheme.vim diff --git a/autoload/repl.vim b/autoload/repl.vim index 7e19b2c..cf41152 100644 --- a/autoload/repl.vim +++ b/autoload/repl.vim @@ -24,6 +24,8 @@ function! repl#run_repl() abort call repl#clojure#open_repl() elseif &filetype ==# 'idris' call repl#idris#open_repl() + elseif &filetype ==# 'scheme' + call repl#scheme#open_repl() else call repl#echo_error("Sorry, repl.vim didn't support this filetype") endif diff --git a/autoload/repl/scheme.vim b/autoload/repl/scheme.vim new file mode 100644 index 0000000..7f753f4 --- /dev/null +++ b/autoload/repl/scheme.vim @@ -0,0 +1,21 @@ +scriptencoding utf-8 + +function! repl#clojure#open_repl() abort + if &modified + let l:module_file = tempname() . '.rkt' + call writefile(getline(1, expand('$')), l:module_file) + else + let l:module_file = expand('%:p') + endif + + let l:repl = repl#get_filetype_repl('scheme') + 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 -f %s %s', l:repl['repl'], l:module_file, l:repl['opt']) + let l:vimshell_interactive = ':VimShellInteractive' . printf("--split='%s'", g:repl_split_command) + execute l:vimshell_interactive l:args +endfunction + diff --git a/plugin/repl.vim b/plugin/repl.vim index cce07b6..334404c 100644 --- a/plugin/repl.vim +++ b/plugin/repl.vim @@ -39,7 +39,7 @@ let g:repl#default_filetype_repl = { \ }, \ 'scheme' : { \ 'repl' : 'racket', -\ 'opt' : '' +\ 'opt' : '-i' \ } \}