From: Gavin Sinclair Date: 2004-01-11T08:38:45+09:00 Subject: Re: Ruby delimiter matching in vim (was block delimiting) On Saturday, January 10, 2004, 3:59:50 AM, Jamis wrote: > Mark J. Reed wrote: >> >>The ftplugin/ruby.vim file needs to set b:match_words appropriately for >>Ruby. I'm using the line below, which so far is working fine for me, >>but as I just now installed matchit after reading Jamis's message, >>I haven't had time to test it thoroughly: >> >> let b:match_words = >> '\<\(begin\|case\|catch\|do\|for\|if\|while\)\>:\<\(elsif\|when\)>:\(else\|ensure\):\' >> >>Many thanks for the pointer, Jamis! >> >>-Mark >> >> > Thanks for the tips on installation, Mark--guess my post should have > been more informative. :) My match_words variable is set to the > following, which works well for me, in case anyone is interested: > let > b:match_words='\<\%(begin\|if\|do\|while\|case\|for\|until\|unless\|def\|class\|module\)\>:'. > \ '\:'. > \ '\<\%(else\|ensure\)\>:'. > \ '\' Here is the relevant line from the ftplugin at http://vim-ruby.rubyforge.org: let b:match_words = \ '\%(\%(\%(^\|[;=]\)\s*\)\@<=\%(class\|module\|while\|begin\|until' . \ '\|for\|if\|unless\|def\|case\)\|\:' . \ '\<\%(else\|elsif\|ensure\|rescue\|when\)\>:' . \ '\%(^\|[^.]\)\@<=\' It works really well. I tried to convert it to a "very magic" regex (I hate backslash-blindndess in Vim regexen), but couldn't get it to work. It's included below in case any Vim gurus are interested. let b:match_words = '\v' . \ '%(%(%(^|[;=])\s*)@<=%(class|module|while|begin|until|for|if|unless|def|case)|:' . \ '<%(else|elsif|ensure|rescue|when)>:' . \ '%(^|[^.])@<=' Gavin