Last Updated: February 25, 2016
·
1.36K
· jodosha

Run RSpec examples from Vim

" Run RSpec examples.
" Loosely inspired by: https://gist.github.com/1062296
function! RunSpec(args)
  let cmd = "bundle exec rspec " . a:args . " " . @%
   execute ":! echo " . cmd . " && " . cmd 
endfunction

map <silent> <leader>r :call RunSpec("")<CR>
map <silent> <leader>re :call RunSpec("-fn -l " . line('.'))<CR>

For this and other Vim configurations, please check my dotfiles.