PATCH: improve b:match_words pattern
Doug Kearns
dougkearns at gmail.com
Wed Sep 7 11:06:31 EDT 2005
This improves the b:match_words pattern. Among other things, it now
handles the if/unless/while/until/rescue modifiers.
It could be refined but the patterns largely match those in the syntax
file which is useful for updating purposes and does no harm.
Regards,
Doug
Index: ftplugin/ruby.vim
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/ftplugin/ruby.vim,v
retrieving revision 1.8
diff -u -r1.8 ruby.vim
--- ftplugin/ruby.vim 2 Sep 2005 14:45:32 -0000 1.8
+++ ftplugin/ruby.vim 7 Sep 2005 14:50:53 -0000
@@ -28,11 +28,24 @@
" Matchit support
if exists("loaded_matchit") && !exists("b:match_words")
let b:match_ignorecase = 0
+ " TODO: improve optional do loops
let b:match_words =
- \ '\%(\%(\%(^\|[;=]\)\s*\)\@<=\%(class\|module\|while\|begin\|until' .
- \ '\|for\|if\|unless\|def\|case\)\|\<do\)\>:' .
- \ '\<\%(else\|elsif\|ensure\|rescue\|when\)\>:' .
- \ '\%(^\|[^.]\)\@<=\<end\>'
+ \ '\%(' .
+ \ '\%(\%(\%(\.\@<!\.\)\|\:\:\)\_s*\)\@<!\<\%(class\|module\|begin\|def\|case\|for\|do\)\>' .
+ \ '\|' .
+ \ '\%(\%(^\|\.\.\.\=\|[;=([<>~\*/%!&^|+-]\)\s*\)\@<=\%(if\|unless\)\>' .
+ \ '\|' .
+ \ '\%(\%(^\|;\)\s*\)\@<=\%(until\|while\)\>' .
+ \ '\)' .
+ \ ':' .
+ \ '\%(' .
+ \ '\%(\%(\%(\.\@<!\.\)\|\:\:\)\_s*\)\@<!\<\%(else\|elsif\|ensure\|when\)\>' .
+ \ '\|' .
+ \ '\%(\%(^\|;\)\s*\)\@<=\<rescue\>' .
+ \ '\)' .
+ \ ':' .
+ \ '\%(\%(\%(\.\@<!\.\)\|\:\:\)\_s*\)\@<!\<end\>' .
+ \ ',=begin:=end'
let b:match_skip =
\ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" .
\ "\<ruby\%(String\|StringDelimiter\|ASCIICode\|Interpolation\|" .
More information about the vim-ruby-devel
mailing list