Matchit and parentheses

Nikolai Weibull now at bitwi.se
Mon May 1 05:36:36 EDT 2006


On 5/1/06, Doug Kearns <dougkearns at gmail.com> wrote:
> On Sun, Apr 30, 2006 at 02:31:56PM +0200, Nikolai Weibull wrote:
> > Why not add ",(:),{:},[:]" to the end of b:match_words so that we take
> > advantage of our knowledge of the language to skip parentheses and
> > braces and so on inside comments?
>
> Seems like a good idea.
>
> Hmmm, it doesn't seem to work for me though...

 let b:match_words =
    \ '\%(' .
    \     '\%(\%(\.\|\:\:\)\s*\|\:\)\@<!\<\%(class\|module\|begin\|def\|case\|for\|do\)\>'
.
    \   '\|' .
    \     '\%(\%(^\|\.\.\.\=\|[\,;=([<>~\*/%!&^|+-]\)\s*\)\@<=\%(if\|unless\|until\|while\)\>'
.
    \ '\)' .
    \ ':' .
    \ '\%(' .
    \     '\%(\%(\.\|\:\:\)\s*\|\:\)\@<!\<\%(else\|elsif\|ensure\|when\)\>' .
    \   '\|' .
    \     '\%(\%(^\|;\)\s*\)\@<=\<rescue\>' .
    \ '\)' .
    \ ':' .
    \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@<!\<end\>' . ',{:},[:],(:)'

works for me.



More information about the vim-ruby-devel mailing list