Skip to content
Browse files

Skip matched 'if' keyword when used as postfix.

  • Loading branch information...
1 parent 97ef4ce commit 22b3424a9ef287ec7b397d3105b793f2a5393ce9 @nelstrom committed Dec 29, 2010
Showing with 3 additions and 2 deletions.
  1. +3 −2 plugin/textobj/rubyblock.vim
View
5 plugin/textobj/rubyblock.vim
@@ -16,11 +16,12 @@ let s:comment_escape = '\v^[^#]*'
let s:block_openers = '\zs(<def>|<if>|<do>|<module>|<class>)'
let s:start_pattern = s:comment_escape . s:block_openers
let s:end_pattern = s:comment_escape . '\zs<end>'
+let s:skip_pattern = 'getline(".") =~ "\\w\\s\\+if"'
function! s:select_a()
let s:flags = 'W'
- call searchpair(s:start_pattern,'',s:end_pattern, s:flags)
+ call searchpair(s:start_pattern,'',s:end_pattern, s:flags, s:skip_pattern)
let end_pos = getpos('.')
" Jump to match
@@ -36,7 +37,7 @@ function! s:select_i()
let s:flags = 'cW'
endif
- call searchpair(s:start_pattern,'',s:end_pattern, s:flags)
+ call searchpair(s:start_pattern,'',s:end_pattern, s:flags, s:skip_pattern)
" Move up one line, and save position
normal k^

0 comments on commit 22b3424

Please sign in to comment.
Something went wrong with that request. Please try again.