Add warning for nothing repl

This commit is contained in:
aiya000 2015-12-19 23:42:44 +09:00
parent a69d896f9b
commit a07657a58d

View File

@ -2,13 +2,12 @@ scriptencoding utf-8
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
"-------------------" "-------------------"
"
"TODO: Branch python2 and python3 "TODO: Branch python2 and python3
"TODO: DRY "TODO: DRY
function! s:sorry() function! s:echo_error(msg)
echohl Error echohl Error
echo "Sorry, repl.vim didn't support this filetype" echo a:msg
echohl None echohl None
endfunction endfunction
@ -28,13 +27,13 @@ function! repl#run_repl()
elseif &filetype ==# 'python' elseif &filetype ==# 'python'
call repl#start_python() call repl#start_python()
elseif &filetype ==# 'scala' elseif &filetype ==# 'scala'
call s:sorry() call s:echo_error("Sorry, repl.vim didn't support this filetype")
"call ReplScala() "call ReplScala()
elseif &filetype ==# 'clojure' elseif &filetype ==# 'clojure'
call s:sorry() call s:echo_error("Sorry, repl.vim didn't support this filetype")
"call ReplClojure() "call ReplClojure()
else else
call s:sorry() call s:echo_error("Sorry, repl.vim didn't support this filetype")
endif endif
endfunction endfunction
@ -53,6 +52,10 @@ function! repl#start_ruby()
\ : g:repl#default_filetype_repl.ruby['repl'] \ : g:repl#default_filetype_repl.ruby['repl']
let l:opt = exists('g:repl_filetype_repl.ruby') ? g:repl_filetype_repl.ruby['opt'] let l:opt = exists('g:repl_filetype_repl.ruby') ? g:repl_filetype_repl.ruby['opt']
\ : g:repl#default_filetype_repl.ruby['opt'] \ : g:repl#default_filetype_repl.ruby['opt']
if !executable(l:repl)
call s: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) let l:args = printf('%s %s %s', l:repl, l:opt, l:module_file)
execute ':VimShellInteractive' l:args execute ':VimShellInteractive' l:args
endfunction endfunction
@ -71,6 +74,10 @@ function! repl#start_haskell()
\ : g:repl#default_filetype_repl.haskell['repl'] \ : g:repl#default_filetype_repl.haskell['repl']
let l:opt = exists('g:repl_filetype_repl.haskell') ? g:repl_filetype_repl.haskell['opt'] let l:opt = exists('g:repl_filetype_repl.haskell') ? g:repl_filetype_repl.haskell['opt']
\ : g:repl#default_filetype_repl.haskell['opt'] \ : g:repl#default_filetype_repl.haskell['opt']
if !executable(l:repl)
call s: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) let l:args = printf('%s %s %s', l:repl, l:opt, l:module_file)
execute ':VimShellInteractive' l:args execute ':VimShellInteractive' l:args
endfunction endfunction
@ -89,6 +96,10 @@ function! repl#start_python()
\ : g:repl#default_filetype_repl.python['repl'] \ : g:repl#default_filetype_repl.python['repl']
let l:opt = exists('g:repl_filetype_repl.python') ? g:repl_filetype_repl.python['opt'] let l:opt = exists('g:repl_filetype_repl.python') ? g:repl_filetype_repl.python['opt']
\ : g:repl#default_filetype_repl.python['opt'] \ : g:repl#default_filetype_repl.python['opt']
if !executable(l:repl)
call s: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) let l:args = printf('%s %s %s', l:repl, l:opt, l:module_file)
execute ':VimShellInteractive' l:args execute ':VimShellInteractive' l:args
endfunction endfunction
@ -109,6 +120,10 @@ function! repl#start_erlang()
\ : g:repl#default_filetype_repl.erlang['repl'] \ : g:repl#default_filetype_repl.erlang['repl']
let l:opt = exists('g:repl_filetype_repl.erlang') ? g:repl_filetype_repl.erlang['opt'] let l:opt = exists('g:repl_filetype_repl.erlang') ? g:repl_filetype_repl.erlang['opt']
\ : g:repl#default_filetype_repl.erlang['opt'] \ : g:repl#default_filetype_repl.erlang['opt']
if !executable(l:repl)
call s: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) let l:args = printf('%s %s %s', l:repl, l:opt, l:module_file)
" Change current directory temporary " Change current directory temporary