From 0f166499e94a5310a8dfed48ae6a10c3c1ad638c Mon Sep 17 00:00:00 2001 From: yan Date: Tue, 3 Jan 2012 09:44:55 -0800 Subject: [PATCH] Added rspec pending to xit feature. Use: ,rxit --- vim/plugin/settings/rspec_pending_to_xit.vim | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 vim/plugin/settings/rspec_pending_to_xit.vim diff --git a/vim/plugin/settings/rspec_pending_to_xit.vim b/vim/plugin/settings/rspec_pending_to_xit.vim new file mode 100644 index 0000000..1800b44 --- /dev/null +++ b/vim/plugin/settings/rspec_pending_to_xit.vim @@ -0,0 +1,22 @@ +" 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 + +map ,rxit :call ChangePendingRspecToXit()