The file that controls this lives at /usr/share/vim/vim80/indent/ruby.vim
. Opening the file, I see it has two variables:
if !exists('g:ruby_indent_access_modifier_style')
" Possible values: "normal", "indent", "outdent"
let g:ruby_indent_access_modifier_style = 'normal'
endif
if !exists('g:ruby_indent_block_style')
" Possible values: "expression", "do"
let g:ruby_indent_block_style = 'expression'
endif
Unfortunately there is no documentation for this at all; either in :help ft-ruby-syntax
or in the file. I tried playing with both, to no avail.
However, at the top of the file there is some author information:
" Language: Ruby
" Maintainer: Nikolai Weibull <now at bitwi.se>
" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <[email protected]>
At that page GitHub, I see a newer version of indent/ruby.vim
which has a new option:
if !exists('g:ruby_indent_assignment_style')
" Possible values: "variable", "hanging"
let g:ruby_indent_assignment_style = 'hanging'
endif
Aha! This looks promising! I saved that file to ~/.vim/indent/ruby.vim
, added let g:ruby_indent_assignment_style = 'variable'
to my vimrc, restarted Vim, and now I get:
some_variable_name = begin
42
end
Which seems to be what you want!
Note that instead of downloading this one file, you may want to clone the entire project and load it as a package with some package manager or Vim's package feature. Unfortunately Vim's runtime files tend to lag a bit behind upstream.