comparison vendor/vim-syntax/eruby.vim @ 623:0f0bdbd8d37d

Update syntax files Additionally nginx repo fixed their cookie thingie.
author nanaya <me@nanaya.pro>
date Mon, 04 Mar 2019 20:01:03 +0900
parents 0e72765944d4
children 6cdd7d26260d
comparison
equal deleted inserted replaced
622:1002aff7e865 623:0f0bdbd8d37d
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 7
7 if exists("b:current_syntax") 8 if &syntax !~# '\<eruby\>' || get(b:, 'current_syntax') =~# '\<eruby\>'
8 finish 9 finish
9 endif 10 endif
10 11
11 if !exists("main_syntax") 12 if !exists("main_syntax")
12 let main_syntax = 'eruby' 13 let main_syntax = 'eruby'
16 let g:eruby_default_subtype = "html" 17 let g:eruby_default_subtype = "html"
17 endif 18 endif
18 19
19 if &filetype =~ '^eruby\.' 20 if &filetype =~ '^eruby\.'
20 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\>')
21 elseif !exists("b:eruby_subtype") && main_syntax == 'eruby' 24 elseif !exists("b:eruby_subtype") && main_syntax == 'eruby'
22 let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") 25 let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
23 let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+') 26 let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+')
24 if b:eruby_subtype == '' 27 if b:eruby_subtype == ''
25 let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$') 28 let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\|\.example\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$')
26 endif 29 endif
27 if b:eruby_subtype == 'rhtml' 30 if b:eruby_subtype == 'rhtml'
28 let b:eruby_subtype = 'html' 31 let b:eruby_subtype = 'html'
29 elseif b:eruby_subtype == 'rb' 32 elseif b:eruby_subtype == 'rb'
30 let b:eruby_subtype = 'ruby' 33 let b:eruby_subtype = 'ruby'
39 let b:eruby_subtype = g:eruby_default_subtype 42 let b:eruby_subtype = g:eruby_default_subtype
40 endif 43 endif
41 endif 44 endif
42 45
43 if !exists("b:eruby_nest_level") 46 if !exists("b:eruby_nest_level")
44 let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.\%(erb\|rhtml\)\>','@','g'),'[^@]','','g')) 47 if &syntax =~# '\<eruby\.eruby\>'
48 let b:eruby_nest_level = strlen(substitute(substitute(&filetype,'\C\<eruby\>','@','g'),'[^@]','','g'))
49 else
50 let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.\%(erb\|rhtml\)\>','@','g'),'[^@]','','g'))
51 endif
45 endif 52 endif
46 if !b:eruby_nest_level 53 if !b:eruby_nest_level
47 let b:eruby_nest_level = 1 54 let b:eruby_nest_level = 1
48 endif 55 endif
49 56
50 if exists("b:eruby_subtype") && b:eruby_subtype != '' 57 if get(b:, 'eruby_subtype', '') !~# '^\%(eruby\)\=$' && &syntax =~# '^eruby\>'
51 exe "runtime! syntax/".b:eruby_subtype.".vim" 58 exe "runtime! syntax/".b:eruby_subtype.".vim"
52 unlet! b:current_syntax
53 endif 59 endif
60 unlet! b:current_syntax
54 syn include @rubyTop syntax/ruby.vim 61 syn include @rubyTop syntax/ruby.vim
55 62
56 syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment 63 syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment
57 64
58 exe 'syn region erubyOneLiner matchgroup=erubyDelimiter start="^%\{1,'.b:eruby_nest_level.'\}%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline' 65 exe 'syn region erubyOneLiner matchgroup=erubyDelimiter start="^%\{1,'.b:eruby_nest_level.'\}%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline'
63 " Define the default highlighting. 70 " Define the default highlighting.
64 71
65 hi def link erubyDelimiter PreProc 72 hi def link erubyDelimiter PreProc
66 hi def link erubyComment Comment 73 hi def link erubyComment Comment
67 74
68 let b:current_syntax = 'eruby' 75 let b:current_syntax = matchstr(&syntax, '^.*\<eruby\>')
69 76
70 if main_syntax == 'eruby' 77 if main_syntax == 'eruby'
71 unlet main_syntax 78 unlet main_syntax
72 endif 79 endif
73 80