2012-01-04 01:44:55 +08:00
|
|
|
" Does not work on pending 'blocks', only single lines
|
|
|
|
"
|
|
|
|
" Given:
|
|
|
|
" it "foo bar" do
|
|
|
|
" pending("bla bla"
|
|
|
|
"
|
|
|
|
" Produce:
|
|
|
|
" xit "foo bar" do
|
|
|
|
"
|
|
|
|
function! ChangePendingRspecToXit()
|
|
|
|
" Find the next occurrence of pending
|
|
|
|
while(search("pending(") > 0)
|
|
|
|
" Delete it
|
|
|
|
normal dd
|
|
|
|
" Search backwards to the it block
|
|
|
|
?it\s
|
|
|
|
" add an 'x' to the 'it' to make it 'xit'
|
|
|
|
normal ix
|
|
|
|
endwhile
|
|
|
|
endfunction
|
|
|
|
|
2012-06-23 02:29:50 +08:00
|
|
|
nnoremap <silent> ,rxit :call ChangePendingRspecToXit()<cr>
|
|
|
|
|
|
|
|
" insert a before { } block around a line
|
2012-07-11 01:09:33 +08:00
|
|
|
nnoremap <silent> \bf ^ibefore { <esc>$a }
|
2012-06-23 02:29:50 +08:00
|
|
|
|
2014-08-08 00:36:39 +08:00
|
|
|
" insert a specify { } block around a line
|
|
|
|
nnoremap <silent> \sp ^ispecify { <esc>$a }
|
|
|
|
|