Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim and Ruby - matching "do"s and "end"s?

Tags:

vim

ruby

I'm sure we're all familiar with the "unexpected kEnd" problem. They are always (to me) a lot of trouble to track down, because Vim doesn't match "do"s and "end"s. (And, obviously, other elements that end with "end", like "if")

Is there a way to configure Vim to show these matches to help make debugging easier?

like image 224
GlyphGryph Avatar asked Nov 09 '11 16:11

GlyphGryph


1 Answers

If you are using a recent vim (I'm using 7.4), the built-in matchit macro works well with ruby code.

Simply enable it by adding the following to your .vimrc

runtime macros/matchit.vim

Hit % to match do/end combos and many others in ruby files.

like image 53
seren23 Avatar answered Sep 30 '22 01:09

seren23