Add variable for user define repl to some filetype
to haskell, ruby
This commit is contained in:
parent
4536b58e5b
commit
850c04525d
@ -1,3 +1,14 @@
|
|||||||
|
let g:repl#default_filetype_repl = get(g:, 'repl_filetype_repl', {
|
||||||
|
\ 'haskell' : {
|
||||||
|
\ 'repl' : 'ghci',
|
||||||
|
\ 'opt' : ''
|
||||||
|
\ },
|
||||||
|
\ 'ruby' : {
|
||||||
|
\ 'repl' : 'irb',
|
||||||
|
\ 'opt' : '--simple-prompt -r'
|
||||||
|
\ }
|
||||||
|
\})
|
||||||
|
|
||||||
function! Repl()
|
function! Repl()
|
||||||
if &filetype == 'ruby'
|
if &filetype == 'ruby'
|
||||||
call ReplRuby()
|
call ReplRuby()
|
||||||
@ -34,7 +45,11 @@ function! ReplRuby()
|
|||||||
let l:module_file = expand('%:p')
|
let l:module_file = expand('%:p')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:args = 'irb --simple-prompt -r ' . l:module_file
|
let l:repl = exists('g:repl_filetype_repl.ruby') ? g:repl_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']
|
||||||
|
\ : g:repl#default_filetype_repl.ruby['opt']
|
||||||
|
let l:args = printf('%s %s %s', l:repl, l:opt, l:module_file)
|
||||||
execute ':VimShellInteractive' l:args
|
execute ':VimShellInteractive' l:args
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -48,7 +63,11 @@ function! ReplHaskell()
|
|||||||
let l:module_file = expand('%:p')
|
let l:module_file = expand('%:p')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:args = 'ghci ' . l:module_file
|
let l:repl = exists('g:repl_filetype_repl.haskell') ? g:repl_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']
|
||||||
|
\ : g:repl#default_filetype_repl.haskell['opt']
|
||||||
|
let l:args = printf('%s %s %s', l:repl, l:opt, l:module_file)
|
||||||
execute ':VimShellInteractive' l:args
|
execute ':VimShellInteractive' l:args
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user