Vim: Highlight keyword pairs in Ruby (def/end, do/end, etc) Vim: Highlight keyword pairs in Ruby (def/end, do/end, etc) ruby ruby

Vim: Highlight keyword pairs in Ruby (def/end, do/end, etc)


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.


VIM (until 7.2) can't highlight a closing 'if/end' pairs because the matching settings accepts a single character (see :help matchpairs).I recommend using folding instead, provided that you accurately indent your code:

:set foldmethod=indent

Then use: zc, za to make sure you're in the right block.


Looks like this vim plugin does paren-matching: http://vimdoc.sourceforge.net/htmldoc/pi_paren.htmlyou could probably dig into that code to see how to extend it to matching other things.