Fork me on GitHub
#vim
<
2017-06-01
>
dominicm08:06:05

I wrote this last night:

function! RunRepl(cmd)
  tabnew
  if executable('rlwrap')
    call termopen('rlwrap ' . a:cmd)
  else
    call termopen(a:cmd)
  endif
  set syntax=clojure
  tabprevious
endfunction

let s:clojure_deps = ['cider/cider-nrepl:0.15.0-SNAPSHOT', 'refactor-nrepl:2.2.0']
let s:boot_middleware = ['cider.nrepl/cider-middleware', 'refactor-nrepl.middleware/wrap-refactor']

function! BootRepl(...)
  let l:boot_string = 'boot -i "(require ''cider.tasks)"'
  for dep in s:boot_deps
    let l:boot_string .= ' -d '.dep
  endfor
  let l:boot_string .= ' cider.tasks/add-middleware'
  for middleware in s:boot_middleware
    let l:boot_string .= ' -m '.middleware
  endfor
  if a:0 > 0 && a:1 != ''
    call RunRepl(l:boot_string.' '.join(a:000, ' '))
  else
    call RunRepl(l:boot_string.' dev')
  endif
endfunction
It allows you to run :Boot [optional task name] and it will inject cider & start boot.

dominicm08:06:28

Thinking of turning it into a separate plugin that works for lein too. Entirely by copying the way cider.el does this. Thoughts?

mikepjb09:06:28

how long before we reinvent emacs @dominicm? 😏

dominicm09:06:17

Is it too magical?

Jarrod Taylor (Clojure team)13:06:56

Personally I like to see good ideas and improved workflows from any source integrated into my own. Recently every time I have started a repl I have wondered why a function doesn't exist to do it for me. I give it a thumbs up (+1 for a lein version).

dominicm13:06:46

I'll package it up then I guess 🙂.

zamaterian13:06:35

@dominicm next time you visit cph, please remember to collect all your 🍻

dominicm13:06:56

@zamaterian will I see you in Berlin again this year?