Just as the vim-ruby bundle supplies motions for jumping between module, class, and method definitions, it also supplies text objects for operating on these constructs. The im object selects inside of a method definition.
That’s exactly the command we were looking for! If we use am instead, it selects all of the method, not just the method body. If your code includes docstring-style comments, then these are also selected by the vam text object. How cool is that?
To summarize: im selects inside the current method, while am selects around the current method. If we use an uppercase M, then we can operate on classes and modules instead of methods. And to complete the table: ir and ar operate on rubyblocks.
Can’t use these object selects. Vim doesn’t understand them. What could be wrong?