Add cpr/cpR maps to require.

In response to discussion in #4.
This commit is contained in:
Tim Pope 2012-12-07 20:15:48 -05:00
parent 19f2f9cc28
commit b3b3ce4bca
2 changed files with 15 additions and 3 deletions

View File

@ -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}.

View File

@ -582,7 +582,7 @@ nnoremap <Plug>ForeplayPrompt :exe <SID>inputeval()<CR>
noremap! <Plug>ForeplayRecall <C-R>=<SID>recall()<CR>
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(<bang>0, <line1>, <line2>, <count>, <q-args>)
nmap <buffer> cp <Plug>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(<bang>0, <q-args>)
nnoremap <silent><buffer> cpr :Require<CR>
nnoremap <silent><buffer> cpR :Require!<CR>
endfunction
augroup foreplay_require
autocmd!
autocmd FileType clojure command! -buffer -bar -bang -complete=customlist,foreplay#ns_complete -nargs=? Require :exe s:Require(<bang>0, <q-args>)
autocmd FileType clojure call s:setup_require()
augroup END
" }}}1