summaryrefslogtreecommitdiff
path: root/runtime/indent/ruby.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-09-25 22:16:38 +0000
committerBram Moolenaar <Bram@vim.org>2005-09-25 22:16:38 +0000
commit1e01546026ce909b5fe56c05867f28e77d1b6eb3 (patch)
tree05ccef65c430097352670acbbeb5520d649ba841 /runtime/indent/ruby.vim
parentbfd8fc0529f46612f7b3efca6c7b3305e70ac374 (diff)
downloadvim-1e01546026ce909b5fe56c05867f28e77d1b6eb3.zip
updated for version 7.0150
Diffstat (limited to 'runtime/indent/ruby.vim')
-rw-r--r--runtime/indent/ruby.vim15
1 files changed, 4 insertions, 11 deletions
diff --git a/runtime/indent/ruby.vim b/runtime/indent/ruby.vim
index ff22bbb41..e5946ebc8 100644
--- a/runtime/indent/ruby.vim
+++ b/runtime/indent/ruby.vim
@@ -82,7 +82,7 @@ let s:end_start_regex = '^\s*\zs\<\%(module\|class\|def\|if\|for' .
let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\<rescue\>\|when\|elsif\)\>'
" Regex that defines the end-match for the 'end' keyword.
-let s:end_end_regex = '\%(^\|[^.]\)\@<=\<end\>'
+let s:end_end_regex = '\%(^\|[^.:]\)\@<=\<end\>'
" Expression used for searchpair() call for finding match for 'end' keyword.
let s:end_skip_expr = s:skip_expr .
@@ -244,17 +244,12 @@ function GetRubyIndent()
" If we have a deindenting keyword, find its match and indent to its level.
" TODO: this is messy
if s:Match(v:lnum, s:ruby_deindent_keywords)
-" let lnum = s:PrevNonBlankNonString(v:lnum - 1)
-"
-" if lnum == 0
-" return 0
-" endif
-"
-" return indent(v:lnum) - &sw
call cursor(v:lnum, 1)
if searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW',
\ s:end_skip_expr) > 0
- if strpart(getline('.'), 0, col('.') - 1) =~ '=\s*'
+ let line = getline('.')
+ if strpart(line, 0, col('.') - 1) =~ '=\s*$' &&
+ \ strpart(line, col('.') - 1, 2) !~ 'do'
let ind = virtcol('.') - 1
else
let ind = indent('.')
@@ -380,5 +375,3 @@ endfunction
let &cpo = s:cpo_save
unlet s:cpo_save
-
-" vim: nowrap sw=2 sts=2 ts=8 ff=unix: