diff options
Diffstat (limited to 'runtime/syntax/ruby.vim')
-rw-r--r-- | runtime/syntax/ruby.vim | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/runtime/syntax/ruby.vim b/runtime/syntax/ruby.vim index 13d6d9efd8..c951fcfe1d 100644 --- a/runtime/syntax/ruby.vim +++ b/runtime/syntax/ruby.vim @@ -3,7 +3,7 @@ " Maintainer: Doug Kearns <dougkearns@gmail.com> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> -" Last Change: 2021 Jun 06 +" Last Change: 2021 Nov 03 " ---------------------------------------------------------------------------- " " Previous Maintainer: Mirko Nasato @@ -66,7 +66,7 @@ endfunction com! -nargs=* SynFold call s:run_syntax_fold(<q-args>) " Not-Top Cluster {{{1 -syn cluster rubyNotTop contains=@rubyCommentNotTop,@rubyStringNotTop,@rubyRegexpSpecial,@rubyDeclaration,@rubyExceptionHandler,@rubyClassOperator,rubyConditional,rubyModuleName,rubyClassName,rubySymbolDelimiter,rubyParentheses,@Spell +syn cluster rubyNotTop contains=@rubyCommentNotTop,@rubyStringNotTop,@rubyRegexpSpecial,@rubyDeclaration,@rubyExceptionHandler,@rubyClassOperator,rubyConditional,rubyModuleName,rubyClassName,rubySymbolDelimiter,rubyDoubleQuoteSymbolDelimiter,rubySingleQuoteSymbolDelimiter,rubyParentheses,@Spell " Whitespace Errors {{{1 if exists("ruby_space_errors") @@ -364,6 +364,9 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") SynFold 'class' syn region rubyClassBlock start="\<class\>" matchgroup=rubyClass skip="\<end:" end="\<end\>" contains=ALLBUT,@rubyNotTop SynFold 'module' syn region rubyModuleBlock start="\<module\>" matchgroup=rubyModule skip="\<end:" end="\<end\>" contains=ALLBUT,@rubyNotTop + " endless def + syn match rubyDefine "\<def\s\+\ze[^[:space:];#(]\+\%(\s\+\|\s*(.*)\s*\)=" nextgroup=rubyMethodDeclaration skipwhite + " modifiers syn match rubyLineContinuation "\\$" nextgroup=@rubyModifier skipwhite skipnl syn match rubyConditionalModifier "\<\%(if\|unless\)\>" @@ -430,9 +433,10 @@ endif " Comments and Documentation {{{1 syn match rubySharpBang "\%^#!.*" display syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE HACK REVIEW XXX todo contained -syn match rubyEncoding "[[:alnum:]-]\+" contained display +syn match rubyEncoding "[[:alnum:]-_]\+" contained display syn match rubyMagicComment "\c\%<3l#\s*\zs\%(coding\|encoding\):" contained nextgroup=rubyEncoding skipwhite syn match rubyMagicComment "\c\%<10l#\s*\zs\%(frozen_string_literal\|warn_indent\|warn_past_scope\):" contained nextgroup=rubyBoolean skipwhite +syn match rubyMagicComment "\c\%<10l#\s*\zs\%(shareable_constant_value\):" contained nextgroup=rubyEncoding skipwhite syn match rubyComment "#.*" contains=@rubyCommentSpecial,rubySpaceError,@Spell syn cluster rubyCommentSpecial contains=rubySharpBang,rubyTodo,rubyMagicComment @@ -465,6 +469,10 @@ syn match rubyDefinedOperator "\%#=1\<defined?" display syn match rubySymbol "\%(\w\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[?!]\=::\@!"he=e-1 contained containedin=rubyBlockParameterList,rubyCurlyBlock syn match rubySymbol "[]})\"':]\@1<!\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="he=e-1 syn match rubySymbol "[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="hs=s+1,he=e-1 +syn match rubySingleQuoteSymbolDelimiter "'" contained +syn match rubySymbol "'\%(\\.\|[^']\)*'::\@!"he=e-1 contains=rubyQuoteEscape,rubyBackslashEscape,rubySingleQuoteSymbolDelimiter +syn match rubyDoubleQuoteSymbolDelimiter "\"" contained +syn match rubySymbol "\"\%(\\.\|[^\"]\)*\"::\@!"he=e-1 contains=@rubyStringSpecial,rubyDoubleQuoteSymbolDelimiter " __END__ Directive {{{1 SynFold '__END__' syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$" @@ -565,6 +573,8 @@ hi def link rubyHeredocDelimiter rubyStringDelimiter hi def link rubyPercentRegexpDelimiter rubyRegexpDelimiter hi def link rubyPercentStringDelimiter rubyStringDelimiter hi def link rubyPercentSymbolDelimiter rubySymbolDelimiter +hi def link rubyDoubleQuoteSymbolDelimiter rubySymbolDelimiter +hi def link rubySingleQuoteSymbolDelimiter rubySymbolDelimiter hi def link rubyRegexpDelimiter rubyStringDelimiter hi def link rubySymbolDelimiter rubySymbol hi def link rubyString String |