This is a tiny update to Running Specs from Vim, Sent to tmux via Tslime from the thoughtbot blog. Go read it, and realize that it's six years old.
vim-rspec has not been updated in two years. It probably still works fine, but there's a new vim plugin that does what vim-rspec does, just better: vim-test.
I finally set this up yesterday:
" Add vim-test and tslime to vim plugins. Plug 'janko/vim-test' Plug 'jgdavey/tslime.vim' ... " Configure vim-test to execute test command using tslime let test#strategy = "tslime" " Configure <CR> aka the Return key to run my test file. nmap <CR> :TestFile<CR> " I'm still figuring out which test commands make the most sense " in my workflow. Right now, this feels pretty good. nmap <leader><CR> :TestLast<CR>
Now, when I'm in normal mode and hit the return key, rspec gets executed for the current file in a different tmux pane (!!). What I didn't understand before using this was how it would select the correct pane. Turns out, it's super easy. On the first run, it asks me for the tmux session, window, and pane (if necessary). After that, it remembers and it always sends the test command there. Super cool!