Created
January 20, 2016 09:43
-
-
Save zamaterian/01524da8998900a502d0 to your computer and use it in GitHub Desktop.
Clojure in neovim, using neovims terminal to communication with lein repl in a split window, instead of tmux.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" requires neovim | |
"https://github.com/neovim/neovim/pull/2076#issuecomment-77793644 | |
if has("nvim") | |
tnoremap <Leader>e <C-\><C-n> | |
tnoremap <C-Enter> startinsert | |
au TermOpen * let g:last_term_job_id = b:terminal_job_id | |
endif | |
function! SendToTerm(lines) | |
call jobsend(g:last_term_job_id, add(a:lines, '')) | |
endfunction | |
function! ResetReplTerm() | |
" if lost which term is a repl term, call from a repl term | |
let g:last_term_job_id = b:terminal_job_id | |
endfunction | |
function! SendToREPL(sexp) | |
call fireplace#session_eval(a:sexp) | |
endfunction | |
function! SyncRepl() | |
call SendToREPL("(require '[clojure.pprint :refer [pprint]])(require '[clojure.repl :refer :all])") | |
call SendToTerm([" (in-ns '" . fireplace#ns() . ") "]) | |
endfunction | |
function! RefreshNS() | |
call SendToREPL("(require '[clojure.tools.namespace.repl :refer [refresh]])(refresh)") | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment