summaryrefslogtreecommitdiff
path: root/runtime/indent
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-09 23:11:18 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-09 23:11:18 +0100
commit2ed639abdc4000436115f378e28320b7bee38a6e (patch)
tree224e20482d2b67d1a680f5487b0515a7714097fa /runtime/indent
parent661ed8b4b6da405c95ede88b0e45ac27adba3f71 (diff)
downloadvim-git-2ed639abdc4000436115f378e28320b7bee38a6e.tar.gz
Update a few runtime files.
Diffstat (limited to 'runtime/indent')
-rw-r--r--runtime/indent/ruby.vim33
1 files changed, 24 insertions, 9 deletions
diff --git a/runtime/indent/ruby.vim b/runtime/indent/ruby.vim
index 5c420d754..23b61fdfe 100644
--- a/runtime/indent/ruby.vim
+++ b/runtime/indent/ruby.vim
@@ -4,7 +4,7 @@
" 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 Jan 06
+" Last Change: 2019 Dec 08
" 0. Initialization {{{1
" =================
@@ -51,15 +51,27 @@ set cpo&vim
" Syntax group names that are strings.
let s:syng_string =
- \ ['String', 'Interpolation', 'InterpolationDelimiter', 'NoInterpolation', 'StringEscape']
+ \ ['String', 'Interpolation', 'InterpolationDelimiter', 'StringEscape']
" Syntax group names that are strings or documentation.
let s:syng_stringdoc = s:syng_string + ['Documentation']
" Syntax group names that are or delimit strings/symbols/regexes or are comments.
-let s:syng_strcom = s:syng_stringdoc +
- \ ['Regexp', 'RegexpDelimiter', 'RegexpEscape',
- \ 'Symbol', 'StringDelimiter', 'ASCIICode', 'Comment']
+let s:syng_strcom = s:syng_stringdoc + [
+ \ 'Character',
+ \ 'Comment',
+ \ 'HeredocDelimiter',
+ \ 'PercentRegexpDelimiter',
+ \ 'PercentStringDelimiter',
+ \ 'PercentSymbolDelimiter',
+ \ 'Regexp',
+ \ 'RegexpCharClass',
+ \ 'RegexpDelimiter',
+ \ 'RegexpEscape',
+ \ 'StringDelimiter',
+ \ 'Symbol',
+ \ 'SymbolDelimiter',
+ \ ]
" Expression used to check whether we should skip a match with searchpair().
let s:skip_expr =
@@ -69,7 +81,7 @@ let s:skip_expr =
let s:ruby_indent_keywords =
\ '^\s*\zs\<\%(module\|class\|if\|for' .
\ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue' .
- \ '\|\%(\K\k*[!?]\?\)\=\s*def\):\@!\>' .
+ \ '\|\%(\K\k*[!?]\?\s\+\)\=def\):\@!\>' .
\ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' .
\ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>'
@@ -83,7 +95,7 @@ let s:ruby_deindent_keywords =
let s:end_start_regex =
\ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' .
\ '\<\%(module\|class\|if\|for\|while\|until\|case\|unless\|begin' .
- \ '\|\%(\K\k*[!?]\?\)\=\s*def\):\@!\>' .
+ \ '\|\%(\K\k*[!?]\?\s\+\)\=def\):\@!\>' .
\ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>'
" Regex that defines the middle-match for the 'end' keyword.
@@ -146,7 +158,7 @@ let s:block_regex =
let s:block_continuation_regex = '^\s*[^])}\t ].*'.s:block_regex
" Regex that describes a leading operator (only a method call's dot for now)
-let s:leading_operator_regex = '^\s*[.]'
+let s:leading_operator_regex = '^\s*\%(&\=\.\)'
" 2. GetRubyIndent Function {{{1
" =========================
@@ -695,7 +707,10 @@ endfunction
" Check if the character at lnum:col is inside a string delimiter
function! s:IsInStringDelimiter(lnum, col) abort
- return s:IsInRubyGroup(['StringDelimiter'], a:lnum, a:col)
+ return s:IsInRubyGroup(
+ \ ['HeredocDelimiter', 'PercentStringDelimiter', 'StringDelimiter'],
+ \ a:lnum, a:col
+ \ )
endfunction
function! s:IsAssignment(str, pos) abort