Mercurial > ec-dotfiles
comparison vendor/vim-syntax/eruby.vim @ 673:6cdd7d26260d
[vim] Update syntaxes and colors
| author | nanaya <me@nanaya.pro> |
|---|---|
| date | Tue, 05 Apr 2022 13:55:06 +0900 |
| parents | 0f0bdbd8d37d |
| children |
comparison
equal
deleted
inserted
replaced
| 672:2febdacae5b4 | 673:6cdd7d26260d |
|---|---|
| 1 " Vim syntax file | 1 " Vim syntax file |
| 2 " Language: eRuby | 2 " Language: eRuby |
| 3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> | 3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> |
| 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: 2018 Jul 04 | 6 " Last Change: 2022 Mar 18 |
| 7 | 7 |
| 8 if &syntax !~# '\<eruby\>' || get(b:, 'current_syntax') =~# '\<eruby\>' | 8 if exists("b:current_syntax") |
| 9 finish | 9 finish |
| 10 endif | 10 endif |
| 11 | 11 |
| 12 if !exists("main_syntax") | 12 if !exists("main_syntax") |
| 13 let main_syntax = 'eruby' | 13 let main_syntax = 'eruby' |
| 17 let g:eruby_default_subtype = "html" | 17 let g:eruby_default_subtype = "html" |
| 18 endif | 18 endif |
| 19 | 19 |
| 20 if &filetype =~ '^eruby\.' | 20 if &filetype =~ '^eruby\.' |
| 21 let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+') | 21 let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+') |
| 22 elseif &filetype =~ '^.*\.eruby\>' | |
| 23 let b:eruby_subtype = matchstr(&filetype,'^.\{-\}\ze\.eruby\>') | |
| 24 elseif !exists("b:eruby_subtype") && main_syntax == 'eruby' | 22 elseif !exists("b:eruby_subtype") && main_syntax == 'eruby' |
| 25 let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") | 23 let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") |
| 26 let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+') | 24 let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+') |
| 27 if b:eruby_subtype == '' | 25 if b:eruby_subtype == '' |
| 28 let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\|\.example\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$') | 26 let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\|\.example\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$') |
| 52 endif | 50 endif |
| 53 if !b:eruby_nest_level | 51 if !b:eruby_nest_level |
| 54 let b:eruby_nest_level = 1 | 52 let b:eruby_nest_level = 1 |
| 55 endif | 53 endif |
| 56 | 54 |
| 57 if get(b:, 'eruby_subtype', '') !~# '^\%(eruby\)\=$' && &syntax =~# '^eruby\>' | 55 if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=? 'eruby' |
| 58 exe "runtime! syntax/".b:eruby_subtype.".vim" | 56 exe "runtime! syntax/".b:eruby_subtype.".vim" |
| 57 unlet! b:current_syntax | |
| 59 endif | 58 endif |
| 60 unlet! b:current_syntax | |
| 61 syn include @rubyTop syntax/ruby.vim | 59 syn include @rubyTop syntax/ruby.vim |
| 62 | 60 |
| 63 syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment | 61 syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment |
| 64 | 62 |
| 65 exe 'syn region erubyOneLiner matchgroup=erubyDelimiter start="^%\{1,'.b:eruby_nest_level.'\}%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline' | 63 exe 'syn region erubyOneLiner matchgroup=erubyDelimiter start="^%\{1,'.b:eruby_nest_level.'\}%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline' |
| 70 " Define the default highlighting. | 68 " Define the default highlighting. |
| 71 | 69 |
| 72 hi def link erubyDelimiter PreProc | 70 hi def link erubyDelimiter PreProc |
| 73 hi def link erubyComment Comment | 71 hi def link erubyComment Comment |
| 74 | 72 |
| 75 let b:current_syntax = matchstr(&syntax, '^.*\<eruby\>') | 73 let b:current_syntax = 'eruby' |
| 76 | 74 |
| 77 if main_syntax == 'eruby' | 75 if main_syntax == 'eruby' |
| 78 unlet main_syntax | 76 unlet main_syntax |
| 79 endif | 77 endif |
| 80 | 78 |
