From 37ace16eac57cfc7ed3094e678ff882753868ab0 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sat, 29 Dec 2012 13:36:02 -0500 Subject: [PATCH] Provide "REPL" on cqP --- plugin/foreplay.vim | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plugin/foreplay.vim b/plugin/foreplay.vim index a61987d..cd3ad49 100644 --- a/plugin/foreplay.vim +++ b/plugin/foreplay.vim @@ -563,6 +563,22 @@ function! s:inputeval() abort endif endfunction +function! s:inputevalloop() abort + while 1 + let input = s:input('') + if input ==# '' + return '' + else + try + echo "\n".foreplay#eval(input) + catch /^Clojure:/ + catch + return 'echoerr '.string(v:exception) + endtry + endif + endwhile +endfunction + function! s:recall() abort try cnoremap ) inputclose() @@ -602,6 +618,7 @@ nnoremap ForeplayEdit :set opfunc=editopg@ xnoremap ForeplayEdit :call editop(visualmode()) nnoremap ForeplayPrompt :exe inputeval() +nnoremap ForeplayLoop :exe inputevalloop() noremap! ForeplayRecall =recall() @@ -618,6 +635,7 @@ function! s:setup_eval() abort nmap cqq ForeplayEditab nmap cqp ForeplayPrompt + nmap cqP ForeplayLoop exe 'nmap cqc ForeplayPrompt' . &cedit . 'i' map! ( ForeplayRecall