nelstrom/vim-textobj-rubyblock — Issue #10: Has trouble selecting rspec blocks
Author: atrerus
Created: 2011-12-05 18:11:35+00:00
State: open

I'm noticing the plugin has trouble selecting rspec blocks. Take this for example:

describe 'Web Service'
it 'should respond to GET' do
GET '/'
last_response.should_be
end
end

For selecting the 'it' block, if I place my cursor at the end of the 'do' the selection works, but if I'm at the beginning of 'it' then it selects the surrounding describe block.

Assuming you're using regex to parse the block delimeters, I'm thinking something like /.*do$/

This would also work for methods in ruby that expect a block, which is a pretty common idiom.