Added idris support

This commit is contained in:
Risto Stevcev 2016-06-12 01:40:21 +02:00
parent 78af766e40
commit a803cd7850
5 changed files with 30 additions and 0 deletions

View File

@ -45,6 +45,7 @@ Run `:Repl` without saving the code on a file.
* Erlang * Erlang
* JavaScript * JavaScript
* Clojure * Clojure
* Idris
## Installation ## Installation

View File

@ -22,6 +22,8 @@ function! repl#run_repl() abort
call repl#javascript#open_repl() call repl#javascript#open_repl()
elseif &filetype ==# 'clojure' elseif &filetype ==# 'clojure'
call repl#clojure#open_repl() call repl#clojure#open_repl()
elseif &filetype ==# 'idris'
call repl#idris#open_repl()
else else
call repl#echo_error("Sorry, repl.vim didn't support this filetype") call repl#echo_error("Sorry, repl.vim didn't support this filetype")
endif endif

22
autoload/repl/idris.vim Normal file
View File

@ -0,0 +1,22 @@
scriptencoding utf-8
function! repl#idris#open_repl() abort
" Setting up the file for the current file
if &modified
" Create new file temporary
let l:module_file = tempname() . '.idr'
call writefile(getline(1, expand('$')), l:module_file)
else
let l:module_file = expand('%:p')
endif
let l:repl = repl#get_filetype_repl('idris')
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 %s', l:repl['repl'], l:repl['opt'], l:module_file)
let l:vimshell_interactive = ':VimShellInteractive' . printf("--split='%s'", g:repl_split_command)
execute l:vimshell_interactive l:args
endfunction

View File

@ -32,6 +32,10 @@ let g:repl#default_filetype_repl = {
\ 'clojure' : { \ 'clojure' : {
\ 'repl' : 'lein', \ 'repl' : 'lein',
\ 'opt' : 'repl' \ 'opt' : 'repl'
\ },
\ 'idris' : {
\ 'repl' : 'idris',
\ 'opt' : ''
\ } \ }
\} \}

View File

@ -14,6 +14,7 @@ function! s:suite.do_not_throw_exception_when_open_repl()
setfiletype python | Repl | new setfiletype python | Repl | new
setfiletype javascript | Repl | new setfiletype javascript | Repl | new
setfiletype clojure | Repl | new setfiletype clojure | Repl | new
setfiletype idris | Repl | new
" repl.vim cannot open repl " repl.vim cannot open repl
" but repl.vim don't throw some exception " but repl.vim don't throw some exception
setfiletype unknown | Repl setfiletype unknown | Repl