diff options
Diffstat (limited to 'indent')
| -rw-r--r-- | indent/ansible.vim | 2 | ||||
| -rw-r--r-- | indent/blade.vim | 4 | ||||
| -rw-r--r-- | indent/crystal.vim | 6 | ||||
| -rw-r--r-- | indent/eruby.vim | 16 | ||||
| -rw-r--r-- | indent/graphql.vim | 2 | ||||
| -rw-r--r-- | indent/ruby.vim | 33 | 
6 files changed, 39 insertions, 24 deletions
| diff --git a/indent/ansible.vim b/indent/ansible.vim index d94d3a2c..29fc8e75 100644 --- a/indent/ansible.vim +++ b/indent/ansible.vim @@ -10,7 +10,7 @@ setlocal expandtab  setlocal softtabstop=2  setlocal shiftwidth=2  setlocal commentstring=#%s -setlocal formatoptions=cl +setlocal formatoptions+=cl  " c -> wrap long comments, including #  " l -> do not wrap long lines diff --git a/indent/blade.vim b/indent/blade.vim index e93d48c9..9fe95742 100644 --- a/indent/blade.vim +++ b/indent/blade.vim @@ -55,9 +55,9 @@ function! GetBladeIndent()      let indent = indent(lnum)      " 1. Check for special directives -    " @section is a single-line directive if it has a second argument. +    " @section and @slot are single-line if they have a second argument.      " @php is a single-line directive if it is followed by parentheses. -    if (line =~# '@section\%(.*@end\)\@!' && line !~# '@section\s*([^,]*)') +    if (line =~# '@\%(section\|slot\)\%(.*@end\)\@!' && line !~# '@\%(section\|slot\)\s*([^,]*)')                  \ || line =~# '@php\s*('          return indent      endif diff --git a/indent/crystal.vim b/indent/crystal.vim index 9fd6c1f8..ae900b62 100644 --- a/indent/crystal.vim +++ b/indent/crystal.vim @@ -49,8 +49,8 @@ let s:skip_expr =  " Regex used for words that, at the start of a line, add a level of indent.  let s:crystal_indent_keywords = -      \ '^\s*\zs\<\%(module\|\%(abstract\)\=\s*\%(class\|struct\)\|enum\|if\|for\|macro' . -      \ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\|lib' . +      \ '^\s*\zs\<\%(module\|\%(private\s\+\)\=\%(abstract\s\+\)\=\%(class\|struct\)\|enum\|if' . +      \ '\|for\|macro\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\|lib' .        \ '\|\%(protected\|private\)\=\s*def\):\@!\>' .        \ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' .        \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>' . @@ -66,7 +66,7 @@ let s:crystal_deindent_keywords =  let s:end_start_regex =        \ '{%\s*\<\%(if\|for\|while\|until\|unless\|begin\|lib\)\>\|' .        \ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' . -      \ '\<\%(module\|\%(abstract\)\=\s*\%(class\|struct\)\|enum\|macro\|if\|for\|while\|until\|case\|unless\|begin\|lib' . +      \ '\<\%(module\|\%(private\s\+\)\=\%(abstract\s\+\)\=\%(class\|struct\)\|enum\|macro\|if\|for\|while\|until\|case\|unless\|begin\|lib' .        \ '\|\%(protected\|private\)\=\s*def\):\@!\>' .        \ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>' diff --git a/indent/eruby.vim b/indent/eruby.vim index cdc5fedf..6fd76600 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -6,7 +6,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1  " URL:			https://github.com/vim-ruby/vim-ruby  " Release Coordinator:	Doug Kearns <dougkearns@gmail.com> -if get(b:, 'did_indent') =~# '\<eruby\>' +if exists("b:did_indent")    finish  endif @@ -14,14 +14,12 @@ runtime! indent/ruby.vim  unlet! b:did_indent  setlocal indentexpr= -if &filetype =~# '^eruby\>' -  if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=# 'eruby' -    exe "runtime! indent/".b:eruby_subtype.".vim" -  else -    runtime! indent/html.vim -  endif +if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=# 'eruby' +  exe "runtime! indent/".b:eruby_subtype.".vim" +else +  runtime! indent/html.vim  endif -let b:did_indent = get(b:, 'did_indent', 1) . '.eruby' +unlet! b:did_indent  " Force HTML indent to not keep state.  let b:html_indent_usestate = 0 @@ -35,6 +33,8 @@ if &l:indentexpr == ''  endif  let b:eruby_subtype_indentexpr = &l:indentexpr +let b:did_indent = 1 +  setlocal indentexpr=GetErubyIndent()  setlocal indentkeys=o,O,*<Return>,<>>,{,},0),0],o,O,!^F,=end,=else,=elsif,=rescue,=ensure,=when diff --git a/indent/graphql.vim b/indent/graphql.vim index ed9cfaa2..9d175777 100644 --- a/indent/graphql.vim +++ b/indent/graphql.vim @@ -15,7 +15,7 @@ setlocal nolisp  setlocal nosmartindent  setlocal indentexpr=GetGraphQLIndent() -setlocal indentkeys=0{,0},0),0[,0],0#,!^F,o,O,e +setlocal indentkeys=0{,0},0),0[,0],0#,!^F,o,O  " If our indentation function already exists, we have nothing more to do.  if exists('*GetGraphQLIndent') 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 | 
