rubyblock is a custom text object for Vim for selecting Ruby blocks. Drew Neil, the developer, explains: “In Ruby, a block is always closed with the end keyword. Ruby blocks may be opened using one of several keywords, including module, class, def if and do. The rubyblock plugin is aware of each of these.”
Neil also notes a limitation:
Some text objects in Vim respond to a count. For example, the `a{` text object will select _all_ of the current `{}` delimited block, but if you prefix it with the number 2 (e.g. `v2i{`) then it will select all of the block that contains the current block. The rubyblock text object does not respond in this way if you prefix a count. This is due to a limitation in vimscript #2100.
However, you can achieve a similar effect by repeating the rubyblock text-object manually. So if you press `var` to select the current ruby block, you can expand your selection outwards by repeating `ar`, or contract your selection inwards by repeating `ir`.
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.