From 236f533cd5724c4d0d98f92b732ecfa2be661c6c Mon Sep 17 00:00:00 2001 From: Juho Teperi Date: Sun, 28 Jun 2015 13:12:33 +0300 Subject: [PATCH 1/2] Configure refactor-repl on session connection --- plugin/cider.vim | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugin/cider.vim b/plugin/cider.vim index 4f34e8f..a22edd2 100644 --- a/plugin/cider.vim +++ b/plugin/cider.vim @@ -109,15 +109,13 @@ nnoremap CiderUndef :call undef() " function! s:init_refactor_nrepl() abort - if !exists('b:refactor_nrepl_loaded') && exists('g:refactor_nrepl_options') - let b:refactor_nrepl_loaded = 1 - call fireplace#message({'op': 'configure', 'opts': g:refactor_nrepl_options}) + if exists('g:refactor_nrepl_options') + let client = g:fireplace_post_connect_session + call client.message({'op': 'configure', 'opts': g:refactor_nrepl_options}, client) endif endfunction function! s:clean_ns() abort - call s:initRefactorNrepl() - " FIXME: Moves cursor let p = expand('%:p') @@ -160,3 +158,7 @@ augroup cider_eval autocmd! autocmd FileType clojure call s:set_up() augroup END + +augroup refactor_nrepl_configure + autocmd User FireplacePostConnect call s:init_refactor_nrepl() +augroup END From 86e9f23f9bebee2d3efb8f52afdb790f283fa7fd Mon Sep 17 00:00:00 2001 From: Juho Teperi Date: Sun, 28 Jun 2015 13:13:25 +0300 Subject: [PATCH 2/2] Use fireplace opfunc --- plugin/cider.vim | 46 +++------------------------------------------- 1 file changed, 3 insertions(+), 43 deletions(-) diff --git a/plugin/cider.vim b/plugin/cider.vim index a22edd2..b23ee0f 100644 --- a/plugin/cider.vim +++ b/plugin/cider.vim @@ -6,49 +6,9 @@ if exists("g:loaded_cider") || v:version < 700 || &cp endif let g:loaded_cider = 1 -" FIXME: From fireplace -function! s:opfunc(type) abort - let sel_save = &selection - let cb_save = &clipboard - let reg_save = @@ - try - set selection=inclusive clipboard-=unnamed clipboard-=unnamedplus - if type(a:type) == type(0) - let open = '[[{(]' - let close = '[]})]' - if getline('.')[col('.')-1] =~# close - let [line1, col1] = searchpairpos(open, '', close, 'bn', g:fireplace#skip) - let [line2, col2] = [line('.'), col('.')] - else - let [line1, col1] = searchpairpos(open, '', close, 'bcn', g:fireplace#skip) - let [line2, col2] = searchpairpos(open, '', close, 'n', g:fireplace#skip) - endif - while col1 > 1 && getline(line1)[col1-2] =~# '[#''`~@]' - let col1 -= 1 - endwhile - call setpos("'[", [0, line1, col1, 0]) - call setpos("']", [0, line2, col2, 0]) - silent exe "normal! `[v`]y" - elseif a:type =~# '^.$' - silent exe "normal! `<" . a:type . "`>y" - elseif a:type ==# 'line' - silent exe "normal! '[V']y" - elseif a:type ==# 'block' - silent exe "normal! `[\`]y" - elseif a:type ==# 'outer' - call searchpair('(','',')', 'Wbcr', g:fireplace#skip) - silent exe "normal! vaby" - else - silent exe "normal! `[v`]y" - endif - redraw - return repeat("\n", line("'<")-1) . repeat(" ", col("'<")-1) . @@ - finally - let @@ = reg_save - let &selection = sel_save - let &clipboard = cb_save - endtry -endfunction +" +" Utils +" function! s:save_regs(fn, ...) let reg_save = @@