diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-05-01 23:21:50 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-05-01 23:47:11 -0400 |
commit | 2081504a331f2ca97922056f6b42b8d0e6c2e306 (patch) | |
tree | 49017e3dac80477d29e9aee14953f905cf1c7f2d /runtime/indent/ruby.vim | |
parent | ac83c6eba65e92d434f3245f518f869c94751e6b (diff) | |
download | rneovim-2081504a331f2ca97922056f6b42b8d0e6c2e306.tar.gz rneovim-2081504a331f2ca97922056f6b42b8d0e6c2e306.tar.bz2 rneovim-2081504a331f2ca97922056f6b42b8d0e6c2e306.zip |
vim-patch:942db23c9cb7
Update runtime files
https://github.com/vim/vim/commit/942db23c9cb7532d68048530d749eb84ca94d0cd
Omit po files.
Diffstat (limited to 'runtime/indent/ruby.vim')
-rw-r--r-- | runtime/indent/ruby.vim | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/runtime/indent/ruby.vim b/runtime/indent/ruby.vim index 23b61fdfe0..657aa763b1 100644 --- a/runtime/indent/ruby.vim +++ b/runtime/indent/ruby.vim @@ -4,7 +4,6 @@ " Previous Maintainer: Nikolai Weibull <now at bitwi.se> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> -" Last Change: 2019 Dec 08 " 0. Initialization {{{1 " ================= @@ -27,7 +26,12 @@ endif if !exists('g:ruby_indent_block_style') " Possible values: "expression", "do" - let g:ruby_indent_block_style = 'expression' + let g:ruby_indent_block_style = 'do' +endif + +if !exists('g:ruby_indent_hanging_elements') + " Non-zero means hanging indents are enabled, zero means disabled + let g:ruby_indent_hanging_elements = 1 endif setlocal nosmartindent @@ -322,7 +326,11 @@ function! s:ClosingBracketOnEmptyLine(cline_info) abort if searchpair(escape(bracket_pair[0], '\['), '', bracket_pair[1], 'bW', s:skip_expr) > 0 if closing_bracket == ')' && col('.') != col('$') - 1 - let ind = virtcol('.') - 1 + if g:ruby_indent_hanging_elements + let ind = virtcol('.') - 1 + else + let ind = indent(line('.')) + end elseif g:ruby_indent_block_style == 'do' let ind = indent(line('.')) else " g:ruby_indent_block_style == 'expression' @@ -547,7 +555,9 @@ function! s:AfterUnbalancedBracket(pline_info) abort let [opening, closing] = s:ExtraBrackets(info.plnum) if opening.pos != -1 - if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 + if !g:ruby_indent_hanging_elements + return indent(info.plnum) + info.sw + elseif opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 if col('.') + 1 == col('$') return indent(info.plnum) + info.sw else @@ -632,8 +642,7 @@ function! s:PreviousNotMSL(msl_info) abort " TODO (2016-10-07) Wrong/unused? How could it be "1"? return indent(info.plnum) - 1 " If previous line is a continuation return its indent. - " TODO: the || s:IsInString() thing worries me a bit. - elseif s:Match(info.plnum, s:non_bracket_continuation_regex) || s:IsInString(info.plnum, strlen(line)) + elseif s:Match(info.plnum, s:non_bracket_continuation_regex) return indent(info.plnum) endif endif |