comparison vendor/vim-syntax/ruby.vim @ 673:6cdd7d26260d

[vim] Update syntaxes and colors
author nanaya <me@nanaya.pro>
date Tue, 05 Apr 2022 13:55:06 +0900
parents c74dffea6a0a
children
comparison
equal deleted inserted replaced
672:2febdacae5b4 673:6cdd7d26260d
1 " Vim syntax file 1 " Vim syntax file
2 " Language: Ruby 2 " Language: Ruby
3 " Maintainer: Doug Kearns <dougkearns@gmail.com> 3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
4 " URL: https://github.com/vim-ruby/vim-ruby 4 " URL: https://github.com/vim-ruby/vim-ruby
5 " Release Coordinator: Doug Kearns <dougkearns@gmail.com> 5 " Release Coordinator: Doug Kearns <dougkearns@gmail.com>
6 " Last Change: 2021 Jun 06 6 " Last Change: 2021 Nov 03
7 " ---------------------------------------------------------------------------- 7 " ----------------------------------------------------------------------------
8 " 8 "
9 " Previous Maintainer: Mirko Nasato 9 " Previous Maintainer: Mirko Nasato
10 " Thanks to perl.vim authors, and to Reimer Behrends. :-) (MN) 10 " Thanks to perl.vim authors, and to Reimer Behrends. :-) (MN)
11 " ---------------------------------------------------------------------------- 11 " ----------------------------------------------------------------------------
64 endfunction 64 endfunction
65 65
66 com! -nargs=* SynFold call s:run_syntax_fold(<q-args>) 66 com! -nargs=* SynFold call s:run_syntax_fold(<q-args>)
67 67
68 " Not-Top Cluster {{{1 68 " Not-Top Cluster {{{1
69 syn cluster rubyNotTop contains=@rubyCommentNotTop,@rubyStringNotTop,@rubyRegexpSpecial,@rubyDeclaration,@rubyExceptionHandler,@rubyClassOperator,rubyConditional,rubyModuleName,rubyClassName,rubySymbolDelimiter,rubyParentheses,@Spell 69 syn cluster rubyNotTop contains=@rubyCommentNotTop,@rubyStringNotTop,@rubyRegexpSpecial,@rubyDeclaration,@rubyExceptionHandler,@rubyClassOperator,rubyConditional,rubyModuleName,rubyClassName,rubySymbolDelimiter,rubyDoubleQuoteSymbolDelimiter,rubySingleQuoteSymbolDelimiter,rubyParentheses,@Spell
70 70
71 " Whitespace Errors {{{1 71 " Whitespace Errors {{{1
72 if exists("ruby_space_errors") 72 if exists("ruby_space_errors")
73 if !exists("ruby_no_trail_space_error") 73 if !exists("ruby_no_trail_space_error")
74 syn match rubySpaceError display excludenl "\s\+$" 74 syn match rubySpaceError display excludenl "\s\+$"
362 362
363 SynFold 'def' syn region rubyMethodBlock start="\<def\>" matchgroup=rubyDefine skip="\<end:\|\%(\<def\_s\+\)\@<=end\>" end="\<end\>" contains=ALLBUT,@rubyNotTop 363 SynFold 'def' syn region rubyMethodBlock start="\<def\>" matchgroup=rubyDefine skip="\<end:\|\%(\<def\_s\+\)\@<=end\>" end="\<end\>" contains=ALLBUT,@rubyNotTop
364 SynFold 'class' syn region rubyClassBlock start="\<class\>" matchgroup=rubyClass skip="\<end:" end="\<end\>" contains=ALLBUT,@rubyNotTop 364 SynFold 'class' syn region rubyClassBlock start="\<class\>" matchgroup=rubyClass skip="\<end:" end="\<end\>" contains=ALLBUT,@rubyNotTop
365 SynFold 'module' syn region rubyModuleBlock start="\<module\>" matchgroup=rubyModule skip="\<end:" end="\<end\>" contains=ALLBUT,@rubyNotTop 365 SynFold 'module' syn region rubyModuleBlock start="\<module\>" matchgroup=rubyModule skip="\<end:" end="\<end\>" contains=ALLBUT,@rubyNotTop
366 366
367 " endless def
368 syn match rubyDefine "\<def\s\+\ze[^[:space:];#(]\+\%(\s\+\|\s*(.*)\s*\)=" nextgroup=rubyMethodDeclaration skipwhite
369
367 " modifiers 370 " modifiers
368 syn match rubyLineContinuation "\\$" nextgroup=@rubyModifier skipwhite skipnl 371 syn match rubyLineContinuation "\\$" nextgroup=@rubyModifier skipwhite skipnl
369 syn match rubyConditionalModifier "\<\%(if\|unless\)\>" 372 syn match rubyConditionalModifier "\<\%(if\|unless\)\>"
370 syn match rubyRepeatModifier "\<\%(while\|until\)\>" 373 syn match rubyRepeatModifier "\<\%(while\|until\)\>"
371 syn match rubyRescueModifier "\<rescue\>" 374 syn match rubyRescueModifier "\<rescue\>"
428 endif 431 endif
429 432
430 " Comments and Documentation {{{1 433 " Comments and Documentation {{{1
431 syn match rubySharpBang "\%^#!.*" display 434 syn match rubySharpBang "\%^#!.*" display
432 syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE HACK REVIEW XXX todo contained 435 syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE HACK REVIEW XXX todo contained
433 syn match rubyEncoding "[[:alnum:]-]\+" contained display 436 syn match rubyEncoding "[[:alnum:]-_]\+" contained display
434 syn match rubyMagicComment "\c\%<3l#\s*\zs\%(coding\|encoding\):" contained nextgroup=rubyEncoding skipwhite 437 syn match rubyMagicComment "\c\%<3l#\s*\zs\%(coding\|encoding\):" contained nextgroup=rubyEncoding skipwhite
435 syn match rubyMagicComment "\c\%<10l#\s*\zs\%(frozen_string_literal\|warn_indent\|warn_past_scope\):" contained nextgroup=rubyBoolean skipwhite 438 syn match rubyMagicComment "\c\%<10l#\s*\zs\%(frozen_string_literal\|warn_indent\|warn_past_scope\):" contained nextgroup=rubyBoolean skipwhite
439 syn match rubyMagicComment "\c\%<10l#\s*\zs\%(shareable_constant_value\):" contained nextgroup=rubyEncoding skipwhite
436 syn match rubyComment "#.*" contains=@rubyCommentSpecial,rubySpaceError,@Spell 440 syn match rubyComment "#.*" contains=@rubyCommentSpecial,rubySpaceError,@Spell
437 441
438 syn cluster rubyCommentSpecial contains=rubySharpBang,rubyTodo,rubyMagicComment 442 syn cluster rubyCommentSpecial contains=rubySharpBang,rubyTodo,rubyMagicComment
439 syn cluster rubyCommentNotTop contains=@rubyCommentSpecial,rubyEncoding 443 syn cluster rubyCommentNotTop contains=@rubyCommentSpecial,rubyEncoding
440 444
463 467
464 " 1.9-style Hash Keys and Keyword Parameters {{{1 468 " 1.9-style Hash Keys and Keyword Parameters {{{1
465 syn match rubySymbol "\%(\w\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[?!]\=::\@!"he=e-1 contained containedin=rubyBlockParameterList,rubyCurlyBlock 469 syn match rubySymbol "\%(\w\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[?!]\=::\@!"he=e-1 contained containedin=rubyBlockParameterList,rubyCurlyBlock
466 syn match rubySymbol "[]})\"':]\@1<!\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="he=e-1 470 syn match rubySymbol "[]})\"':]\@1<!\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="he=e-1
467 syn match rubySymbol "[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="hs=s+1,he=e-1 471 syn match rubySymbol "[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="hs=s+1,he=e-1
472 syn match rubySingleQuoteSymbolDelimiter "'" contained
473 syn match rubySymbol "'\%(\\.\|[^']\)*'::\@!"he=e-1 contains=rubyQuoteEscape,rubyBackslashEscape,rubySingleQuoteSymbolDelimiter
474 syn match rubyDoubleQuoteSymbolDelimiter "\"" contained
475 syn match rubySymbol "\"\%(\\.\|[^\"]\)*\"::\@!"he=e-1 contains=@rubyStringSpecial,rubyDoubleQuoteSymbolDelimiter
468 476
469 " __END__ Directive {{{1 477 " __END__ Directive {{{1
470 SynFold '__END__' syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$" 478 SynFold '__END__' syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$"
471 479
472 " Default Highlighting {{{1 480 " Default Highlighting {{{1
563 hi def link rubyStringDelimiter Delimiter 571 hi def link rubyStringDelimiter Delimiter
564 hi def link rubyHeredocDelimiter rubyStringDelimiter 572 hi def link rubyHeredocDelimiter rubyStringDelimiter
565 hi def link rubyPercentRegexpDelimiter rubyRegexpDelimiter 573 hi def link rubyPercentRegexpDelimiter rubyRegexpDelimiter
566 hi def link rubyPercentStringDelimiter rubyStringDelimiter 574 hi def link rubyPercentStringDelimiter rubyStringDelimiter
567 hi def link rubyPercentSymbolDelimiter rubySymbolDelimiter 575 hi def link rubyPercentSymbolDelimiter rubySymbolDelimiter
576 hi def link rubyDoubleQuoteSymbolDelimiter rubySymbolDelimiter
577 hi def link rubySingleQuoteSymbolDelimiter rubySymbolDelimiter
568 hi def link rubyRegexpDelimiter rubyStringDelimiter 578 hi def link rubyRegexpDelimiter rubyStringDelimiter
569 hi def link rubySymbolDelimiter rubySymbol 579 hi def link rubySymbolDelimiter rubySymbol
570 hi def link rubyString String 580 hi def link rubyString String
571 hi def link rubyRegexpEscape rubyRegexpSpecial 581 hi def link rubyRegexpEscape rubyRegexpSpecial
572 hi def link rubyRegexpQuantifier rubyRegexpSpecial 582 hi def link rubyRegexpQuantifier rubyRegexpSpecial