% Matching With Vim/Ruby

Scott LaBounty slabounty at nexatech.com
Fri May 21 09:21:25 EDT 2010


All,

Not sure if this is the right list or not, but I'm trying to get matching to work (using %) in vim in a ruby file. For example if I have the following code:

1.upto(10) do |n|
    puts n
end

If the cursor is on the "do", I'd like to hit the "%" key and have it go to "end".

I have the following in an .vim/after/ftplugin/ruby.vim

if exists("loaded_matchit")
    if !exists("b:match_words")
        let b:match_ignorecase = 0
        let b:match_words =
                    \ '\%(\%(\%(^\|[;=]\)\s*\)\@<=\%(class\|module\|while\|begin\|until\|for\|if\|unless\|def\|case\)\|\<do\)\>:' .
                    \ '\<\%(else\|elsif\|ensure\|rescue\|when\)\>:\%(^\|[^.]\)\@<=\<end\>'
    endif
endif


which is what I had in an older system. I believe that matchit.vim is loaded already (by default).

Any ideas on getting this to work or alternative ways of doing this?

Scott

Confidentiality Statement:
This message is confidential and may contain confidential information it is intended only for the individual[s] named herein. If this message is being sent from a member of the legal department, it may also be legally privileged. If you are not the named addressee[s] you must delete this email immediately; do not disseminate, distribute or copy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/vim-ruby-devel/attachments/20100521/d3192b8d/attachment-0001.html>


More information about the vim-ruby-devel mailing list