Last active
December 16, 2015 08:19
-
-
Save ccashwell/5405446 to your computer and use it in GitHub Desktop.
Vim mappings to (a) run rspec tests in-line, and (b) shell the iOS simulator
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
" RSpec mappings: | |
" <Leader>rs – run entire spec suite | |
" <Leader>rd – run all specs in the pwd | |
" <Leader>rf – run all specs in the current file | |
" <Leader>rl – run the line under the cursor | |
noremap <Leader>rs :call RunSpec('spec', '-fp')<CR> | |
noremap <Leader>rd :call RunSpec(expand('%:h'), '-fd')<CR> | |
noremap <Leader>rf :call RunSpec(expand('%'), '-fd')<CR> | |
noremap <Leader>rl :call RunSpec(expand('%'), '-fd -l ' . line('.'))<CR> | |
function! RunSpec(spec_path, spec_opts) | |
let speccish = match(@%, '_spec.rb$') != -1 | |
if speccish | |
exec '!rspec --no-color ' . a:spec_opts . ' ' . a:spec_path | |
else | |
echo '<< WARNING >> RunSpec() can only be called from inside spec files!' | |
endif | |
endfunction | |
" iOS Simulator mapping: | |
" <Leader>is – open iOS Simulator | |
noremap <Leader>is :!open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app<CR><CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment