Created
August 28, 2021 08:00
-
-
Save nanonanomachine/1bfbbc2238f057c2fc8770105ecc6824 to your computer and use it in GitHub Desktop.
vim-iced + kaocha test under cursor without vim-iced-kaocha
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
function! KaochaTestNs() abort | |
let l:yank = @" | |
call iced#nrepl#ns#yank_name() | |
let l:ns = @" | |
let l:kaocha_run = "(k/run '".l:ns.")" | |
call iced#repl#execute('eval_code', "(require '[kaocha.repl :as k])", {'ignore_session_validity': v:true}) | |
call iced#repl#execute('eval_code', l:kaocha_run, {'ignore_session_validity': v:true}) | |
let @" = l:yank | |
endfunction | |
function! KaochaTestUnderCursor() abort | |
let l:yank = @" | |
call iced#nrepl#ns#yank_name() | |
let l:ns = @" | |
normal yiw | |
let l:kaocha_run = "(k/run '".l:ns."/".@".")" | |
call iced#repl#execute('eval_code', "(require '[kaocha.repl :as k])", {'ignore_session_validity': v:true}) | |
call iced#repl#execute('eval_code', l:kaocha_run, {'ignore_session_validity': v:true}) | |
let @" = l:yank | |
endfunction | |
aug MyClojureSetting | |
au! | |
au FileType clojure nmap <silent><buffer> <Leader>ktn :call KaochaTestNs()<CR> | |
au FileType clojure nmap <silent><buffer> <Leader>ktt :call KaochaTestUnderCursor()<CR> | |
aug END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment