From b3b3ce4bcaeccbd7aaf7776200940017bf1b913b Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 7 Dec 2012 20:15:48 -0500 Subject: [PATCH] Add cpr/cpR maps to require. In response to discussion in #4. --- doc/foreplay.txt | 6 ++++++ plugin/foreplay.vim | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/doc/foreplay.txt b/doc/foreplay.txt index fb4292a..6e48312 100644 --- a/doc/foreplay.txt +++ b/doc/foreplay.txt @@ -119,6 +119,12 @@ cp{motion} Eval/print the code indicated by {motion}. cpp Eval/print the inner-most expr at the cursor. + *foreplay-cpr* +cpr Eval a require :reload form. + + *foreplay-cpR* +cpR Eval a require :reload-all form. + *foreplay-c!* c!{motion} Eval/replace the code indicated by {motion}. diff --git a/plugin/foreplay.vim b/plugin/foreplay.vim index 596cece..a7ab4d2 100644 --- a/plugin/foreplay.vim +++ b/plugin/foreplay.vim @@ -582,7 +582,7 @@ nnoremap ForeplayPrompt :exe inputeval() noremap! ForeplayRecall =recall() -function! s:eval_setup() abort +function! s:setup_eval() abort command! -buffer -bang -range=0 -nargs=? -complete=customlist,foreplay#eval_complete Eval :exe s:Eval(0, , , , ) nmap cp ForeplayPrint @@ -612,7 +612,7 @@ endfunction augroup foreplay_eval autocmd! - autocmd FileType clojure call s:eval_setup() + autocmd FileType clojure call s:setup_eval() autocmd CmdWinEnter @ if exists('s:input') | call s:cmdwinenter() | endif autocmd CmdWinLeave @ if exists('s:input') | call s:cmdwinleave() | endif augroup END @@ -631,9 +631,15 @@ function! s:Require(bang, ns) endtry endfunction +function! s:setup_require() + command! -buffer -bar -bang -complete=customlist,foreplay#ns_complete -nargs=? Require :exe s:Require(0, ) + nnoremap cpr :Require + nnoremap cpR :Require! +endfunction + augroup foreplay_require autocmd! - autocmd FileType clojure command! -buffer -bar -bang -complete=customlist,foreplay#ns_complete -nargs=? Require :exe s:Require(0, ) + autocmd FileType clojure call s:setup_require() augroup END " }}}1