Skip to content

Commit a4c0b8a

Browse files
Separate execution from generation
This allows the external running of the generated commands, as they don't have to be run through neovim directly anymore.
1 parent 6aafcbf commit a4c0b8a

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

autoload/jack_in.vim

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function! s:RunRepl(cmd)
88
endif
99
endfunction
1010

11-
function! jack_in#boot(...)
11+
function! jack_in#boot_cmd(...)
1212
let l:boot_string = 'boot -x -i "(require ''cider.tasks)"'
1313
for [dep, inj] in items(g:jack_in_injections)
1414
let l:boot_string .= printf(' -d %s:%s', dep, inj['version'])
@@ -22,10 +22,14 @@ function! jack_in#boot(...)
2222
else
2323
let l:boot_task = g:default_boot_task
2424
endif
25-
call s:RunRepl(l:boot_string.' '.l:boot_task)
25+
return l:boot_string.' '.l:boot_task
2626
endfunction
2727

28-
function! jack_in#lein(...)
28+
function! jack_in#boot(...)
29+
call s:RunRepl(call(function('jack_in#boot_cmd'), a:000))
30+
endfunction
31+
32+
function! jack_in#lein_cmd(...)
2933
let l:lein_string = 'lein'
3034
for [dep, inj] in items(g:jack_in_injections)
3135
let l:dep_vector = printf('''[%s "%s"]''', dep, inj['version'])
@@ -41,10 +45,15 @@ function! jack_in#lein(...)
4145
else
4246
let l:lein_task = g:default_lein_task
4347
endif
44-
call s:RunRepl(l:lein_string.' '.l:lein_task)
48+
49+
return l:lein_string.' '.l:lein_task
4550
endfunction
4651

47-
function! jack_in#clj(...)
52+
function! jack_in#lein(...)
53+
call s:RunRepl(call(function('jack_in#lein_cmd'), a:000))
54+
endfunction
55+
56+
function! jack_in#clj_cmd(...)
4857
let l:clj_string = 'clj'
4958
let l:deps_map = '{:deps {'
5059
let l:cider_opts = '-e ''(require (quote cider-nrepl.main)) (cider-nrepl.main/init ['
@@ -57,7 +66,9 @@ function! jack_in#clj(...)
5766
let l:deps_map .= '}}'
5867
let l:cider_opts .= '])'''
5968

60-
let l:command = l:clj_string . ' ' . join(a:000, ' ') . ' -Sdeps ''' . l:deps_map . ''' ' . l:cider_opts . ' '
69+
return l:clj_string . ' ' . join(a:000, ' ') . ' -Sdeps ''' . l:deps_map . ''' ' . l:cider_opts . ' '
70+
endfunction
6171

62-
call s:RunRepl(l:command)
72+
function! jack_in#clj(...)
73+
call s:RunRepl(call(function('jack_in#clj_cmd'), a:000))
6374
endfunction

0 commit comments

Comments
 (0)