Skip to content

Instantly share code, notes, and snippets.

@iboard
Last active January 20, 2019 07:58
Show Gist options
  • Save iboard/11134399 to your computer and use it in GitHub Desktop.
Save iboard/11134399 to your computer and use it in GitHub Desktop.
Vim-functions to run rspec from current file, line
" Call rspec from vim
" Apr 21st, 2014 Andi Altendorfer <andreas@altendorfer.at>
"
" RspecLine() ... run rspec for the current cursor line
" RspecFile() ... run rspec for the current file
" RspecAll() .... run entire suite
"
" Copy this file to your ./vim/pluglin directory
function RspecLine()
execute "!rspec -fd %:" . line(".")
endfunction
function RspecFile()
execute "!rspec -fd %"
endfunction
function RspecAll()
execute "!rspec -fd"
endfunction
nmap <c-j>rl :call RspecLine()<CR>
nmap <c-j>rf :call RspecFile()<CR>
nmap <c-j>ra :call RspecAll()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment