diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2019-03-04 09:15:44 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2019-03-04 09:15:44 +0100 |
commit | ed677c34d55a0e025b7008f29419498a3989cde2 (patch) | |
tree | 62efef78ed05b2b4e61efb21e40a6b337359eb8e /indent/ruby.vim | |
parent | c161994e9607399a7b365ab274592bfc4f100306 (diff) | |
download | vim-polyglot-ed677c34d55a0e025b7008f29419498a3989cde2.tar.gz vim-polyglot-ed677c34d55a0e025b7008f29419498a3989cde2.zip |
Update
Diffstat (limited to 'indent/ruby.vim')
-rw-r--r-- | indent/ruby.vim | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/indent/ruby.vim b/indent/ruby.vim index 78d10d7a..a3141ed4 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1 " Vim indent file " Language: Ruby -" Maintainer: Nikolai Weibull <now at bitwi.se> +" Maintainer: Andrew Radev <andrey.radev@gmail.com> +" Previous Maintainer: Nikolai Weibull <now at bitwi.se> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> @@ -51,15 +52,26 @@ 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', + \ '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 |