In one of the Eclipse-based editors that I tried out recently (I think it was RubyMine), when a Ruby keyword that either opened or closed a method or block was selected, the corresponding open/close keyword was highlighted. Similar to the way that Vim is able to highlight a corresponding open/close parenthesis.
For instance, if I selected a 'def', it would highlight the corresponding 'end'. It also worked for do/end blocks.
This was really handy, especially for those long and sometimes heavily nested Rspec files.
Does anybody know how to achieve this in Vim?
If you are using Vim 7.3, you should have the MatchIt vim macro available.
Add runtime macros/matchit.vim
to your .vimrc
file and you should be able to use % to match the ruby blocks.
You can look at the filetype plugin for ruby to see what it will move between.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With