summaryrefslogtreecommitdiffstats
path: root/indent/ruby.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2015-03-08 21:32:50 -0700
committerAdam Stankiewicz <sheerun@sher.pl>2015-03-08 21:32:50 -0700
commit23913e0598d23ec5948b71ea78c549b39cecf764 (patch)
treef21bd3dd20a7fe0e46bed7dd11329a204fe4cc3f /indent/ruby.vim
parent1c2123117537fb4bccf87fcf39abc05eaf950ec2 (diff)
downloadvim-polyglot-23913e0598d23ec5948b71ea78c549b39cecf764.tar.gz
vim-polyglot-23913e0598d23ec5948b71ea78c549b39cecf764.zip
Updatev1.12.1
Diffstat (limited to 'indent/ruby.vim')
-rw-r--r--indent/ruby.vim15
1 files changed, 14 insertions, 1 deletions
diff --git a/indent/ruby.vim b/indent/ruby.vim
index 1acde808..f0dde6fa 100644
--- a/indent/ruby.vim
+++ b/indent/ruby.vim
@@ -440,10 +440,14 @@ function GetRubyIndent(...)
if strpart(line, 0, col('.') - 1) =~ '=\s*$' &&
\ strpart(line, col('.') - 1, 2) !~ 'do'
+ " assignment to case/begin/etc, on the same line, hanging indent
let ind = virtcol('.') - 1
elseif getline(msl) =~ '=\s*\(#.*\)\=$'
+ " in the case of assignment to the msl, align to the starting line,
+ " not to the msl
let ind = indent(line('.'))
else
+ " align to the msl
let ind = indent(msl)
endif
endif
@@ -508,7 +512,16 @@ function GetRubyIndent(...)
" If the previous line ended with a block opening, add a level of indent.
if s:Match(lnum, s:block_regex)
- return indent(s:GetMSL(lnum)) + sw
+ let msl = s:GetMSL(lnum)
+
+ if getline(msl) =~ '=\s*\(#.*\)\=$'
+ " in the case of assignment to the msl, align to the starting line,
+ " not to the msl
+ let ind = indent(lnum) + sw
+ else
+ let ind = indent(msl) + sw
+ endif
+ return ind
endif
" If the previous line started with a leading operator, use its MSL's level