Fork me on GitHub
#vim
<
2018-05-19
>
dominicm16:05:22

let g:eval_view = 0

augroup RestoreView
    autocmd!
    autocmd User FireplaceEvalPost call RestoreView()
augroup END

function! FireplaceEval(op)
  let g:eval_view = winsaveview()
  call feedkeys(a:op, 'ti')
endfunction

function! RestoreView()
  if g:eval_view isnot 0
    call winrestview(g:eval_view)
    let g:eval_view = 0
  endif
endfunction

autocmd FileType clojure nmap <buffer><expr> cp FireplaceEval("\<Plug>FireplacePrint")
autocmd FileType clojure nmap <buffer><expr> cpp FireplaceEval("\<Plug>FireplaceCountPrint")
Stop fireplace cp from jumping all over the place. Haven't tested extensively, just hacked it up now.

dominicm17:05:06

Much better than my last version which interpreted 'printop' to make decisions. I expect this actually works everywhere.

dominicm17:05:28

I might stick it in replant, thoughts?

fatihict19:05:36

Oh nice, never occurred to me that cp was causing that. I think it would be a nice addition to replant

dominicm20:05:22

It's not neovim specific, like much of replant. Maybe it could go into a "clojure-for-regular-people" or something like that

dominicm20:05:49

That might be a good location to place replant mappings which match spacemacs or something.