Skip to content

Instantly share code, notes, and snippets.

@zamaterian
Created April 7, 2015 19:32
Show Gist options
  • Save zamaterian/dfbafbeef178daf5c21b to your computer and use it in GitHub Desktop.
Save zamaterian/dfbafbeef178daf5c21b to your computer and use it in GitHub Desktop.
in .nvimrc add
" requires vim-fireplace
au TermOpen * let g:last_term_job_id = b:terminal_job_id
function! SendToTerm(lines)
call jobsend(g:last_term_job_id, add(a:lines, ''))
endfunction
function! SyncRepl()
call SendToREPL("(require '[clojure.pprint :refer [pprint]])(require '[clojure.repl :refer :all])")
call SendToTerm([" (in-ns '" . fireplace#ns() . ") "] )
endfunction
function! SendToREPL(sexp)
call fireplace#session_eval(a:sexp)
endfunction
nnoremap <silent> <Leader>fr :call SyncRepl()<CR>
----------
start nvim in a dir with a lein project
:sp
:terminal lein repl
-------------
in another buffer open a clj file
:e src/core.clj
<leader>fr
" now the lein repl has changed into the core.clj namespace instead of the user namespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment