10 years ago
Requires tpope's vim-fireplace.
The built-in cpr
to run tests in the current file is awesome, but requires you to jump back to your test file to run them. cpt
will now "do the right thing" based on namespace. For example, if you're in the core
namespace and have your unit-tests in the core-test
namespace, you can be in either core.clj
or core_test.clj
and type cpt
to run the tests.
I keep this in my ftplugin/clojure.vim
function! RunBufferTests() let ns = fireplace#ns() if ns !~ '-test$' let ns = ns . "-test" endif silent :Require exe "RunTests " . ns endfunction nnoremap <buffer> cpt :call RunBufferTests()<cr>