-
-
Save flipjs/fcba1d9fe18cb41587be0de41c58a9a2 to your computer and use it in GitHub Desktop.
run your tests in a separate tmux pane!
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
" when triggering this command, vim will grab your path and line location and pass it along | |
map <Leader>el :call RemoteSendCommand(TestLineCommand(expand("%:p"), line(".")))<CR> | |
" because I'm mostly writing Elixir and making heavy use of the REPL while writing my tests, | |
" I made a specifc command to user with Mix, the Elixir task utility | |
" But I'm sure you could get this to work with vim-test or something like that | |
function! TestLineCommand(path, line_number) | |
let cmd = join(["mix test --only", " line:", a:line_number, " ", a:path], "") | |
return cmd | |
endfunction | |
" Here, -t 6 specifies the pane you're sending the keys to | |
function! RemoteSendCommand(cmd) | |
execute "! tmux send-keys -t 6 \"" . a:cmd . "\" C-m" | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment