Skip to content

Instantly share code, notes, and snippets.

@eltonlaw
Last active March 30, 2019 18:10
Show Gist options
  • Save eltonlaw/a8db161663c34b2cc791427e9545a8e0 to your computer and use it in GitHub Desktop.
Save eltonlaw/a8db161663c34b2cc791427e9545a8e0 to your computer and use it in GitHub Desktop.
" ~/.vim/ftplugin/clojure.vim
let g:slime_target = "tmux"
map <LocalLeader>co :call VimuxStartLeinREPL()<CR>
map <LocalLeader>cd :call VimuxDefinePreviousEval()<CR>
map <LocalLeader>cl :call VimuxReloadNS(":reload")<CR>
map <LocalLeader>cL :call VimuxReloadNS(":reload-all")<CR>
map <LocalLeader>ct :call VimuxRunTests()<CR>
function! VimuxStartLeinREPL()
let g:VimuxUseNearest = 0
call VimuxOpenRunner()
let cmd="lein repl"
if filereadable(".nrepl-port")
let cmd=cmd." :connect"
endif
call VimuxSendText(cmd)
call VimuxSendKeys("Enter")
let g:VimuxUseNearest = 1
endfunction
function! VimuxDefinePreviousEval()
let text = @v
let curline = getline('.')
call inputsave()
let defname = input('def: ')
call inputrestore()
call VimuxSendText("(def ".defname." ".text.")")
call VimuxSendKeys("Enter")
endfunction
function! VimuxReloadNS(rtype)
let namespace = @a ? @a : fireplace#ns()
let @a = namespace
call VimuxSendText("(require '[".namespace."] ".a:rtype.")")
call VimuxSendKeys("Enter")
endfunction
function! VimuxRunTests()
let namespace = @b ? @b : fireplace#ns()
let @b = namespace
call VimuxSendText("(clojure.test/run-tests '" . namespace ")")
call VimuxSendKeys("Enter")
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment