From bf4ca57db1566b76a4dce30dbf73b158abed8726 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 8 Jan 2014 00:50:46 -0500 Subject: [PATCH] Extract python command generation --- autoload/nrepl/fireplace_connection.vim | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/autoload/nrepl/fireplace_connection.vim b/autoload/nrepl/fireplace_connection.vim index 5433dd4..2d8b0db 100644 --- a/autoload/nrepl/fireplace_connection.vim +++ b/autoload/nrepl/fireplace_connection.vim @@ -167,14 +167,17 @@ endfunction let s:keepalive = tempname() call writefile([getpid()], s:keepalive) -function! s:nrepl_dispatch(command, ...) dict abort - let in = 'python' +function! s:nrepl_command(args) dict abort + return 'python' \ . ' ' . s:shellesc(s:python_dir.'/nrepl_fireplace.py') \ . ' ' . s:shellesc(self.host) \ . ' ' . s:shellesc(self.port) \ . ' ' . s:shellesc(s:keepalive) - \ . ' ' . s:shellesc(a:command) - \ . ' ' . join(map(copy(a:000), 's:shellesc(v:val)'), ' ') + \ . ' ' . join(map(copy(a:args), 's:shellesc(v:val)'), ' ') +endfunction + +function! s:nrepl_dispatch(...) dict abort + let in = self.command(a:000) let out = system(in) if !v:shell_error return eval(out) @@ -208,6 +211,7 @@ function! s:nrepl_call(payload) dict abort endfunction let s:nrepl = { + \ 'command': s:function('s:nrepl_command'), \ 'dispatch': s:function('s:nrepl_dispatch'), \ 'prepare': s:function('s:nrepl_prepare'), \ 'call': s:function('s:nrepl_call'),