Skip to content

Instantly share code, notes, and snippets.

@evanphx
Created February 17, 2011 06:11
Show Gist options
  • Save evanphx/831119 to your computer and use it in GitHub Desktop.
Save evanphx/831119 to your computer and use it in GitHub Desktop.
diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim
index 07358b2..3b40da3 100644
--- a/ftplugin/ruby.vim
+++ b/ftplugin/ruby.vim
@@ -29,8 +29,11 @@ endif
if exists("loaded_matchit") && !exists("b:match_words")
let b:match_ignorecase = 0
+ " Go go gadget match! This ignores if, unless, while, and until if they come
+ " after non-spaces, meaning they're a post condition.
let b:match_words =
- \ '\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|def\|begin\)\>=\@!' .
+ \ '\%(\%(\%(\_^\s\+\)\|\%(\;\s*\)\)\@<=\<\%(if\|unless\|while\|until\)\)' .
+ \ '\|\%(\<\%(do\|case\|for\|class\|module\|def\|begin\)\)\>=\@!' .
\ ':' .
\ '\<\%(else\|elsif\|ensure\|when\|rescue\|break\|redo\|next\|retry\)\>' .
\ ':' .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment