annotate vendor/vim-syntax/eruby.vim @ 693:37a2470380f2

[bashrc] Fix comment about freebsd grep
author nanaya <me@nanaya.pro>
date Sun, 23 Oct 2022 01:56:54 +0900
parents 6cdd7d26260d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
1 " Vim syntax file
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
2 " Language: eRuby
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
4 " URL: https://github.com/vim-ruby/vim-ruby
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
5 " Release Coordinator: Doug Kearns <dougkearns@gmail.com>
673
6cdd7d26260d [vim] Update syntaxes and colors
nanaya <me@nanaya.pro>
parents: 623
diff changeset
6 " Last Change: 2022 Mar 18
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
7
673
6cdd7d26260d [vim] Update syntaxes and colors
nanaya <me@nanaya.pro>
parents: 623
diff changeset
8 if exists("b:current_syntax")
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
9 finish
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
10 endif
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
11
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
12 if !exists("main_syntax")
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
13 let main_syntax = 'eruby'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
14 endif
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
15
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
16 if !exists("g:eruby_default_subtype")
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
17 let g:eruby_default_subtype = "html"
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
18 endif
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
19
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
20 if &filetype =~ '^eruby\.'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
21 let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+')
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
22 elseif !exists("b:eruby_subtype") && main_syntax == 'eruby'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
23 let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
24 let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+')
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
25 if b:eruby_subtype == ''
623
0f0bdbd8d37d Update syntax files
nanaya <me@nanaya.pro>
parents: 595
diff changeset
26 let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\|\.example\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$')
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
27 endif
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
28 if b:eruby_subtype == 'rhtml'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
29 let b:eruby_subtype = 'html'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
30 elseif b:eruby_subtype == 'rb'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
31 let b:eruby_subtype = 'ruby'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
32 elseif b:eruby_subtype == 'yml'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
33 let b:eruby_subtype = 'yaml'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
34 elseif b:eruby_subtype == 'js'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
35 let b:eruby_subtype = 'javascript'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
36 elseif b:eruby_subtype == 'txt'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
37 " Conventional; not a real file type
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
38 let b:eruby_subtype = 'text'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
39 elseif b:eruby_subtype == ''
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
40 let b:eruby_subtype = g:eruby_default_subtype
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
41 endif
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
42 endif
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
43
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
44 if !exists("b:eruby_nest_level")
623
0f0bdbd8d37d Update syntax files
nanaya <me@nanaya.pro>
parents: 595
diff changeset
45 if &syntax =~# '\<eruby\.eruby\>'
0f0bdbd8d37d Update syntax files
nanaya <me@nanaya.pro>
parents: 595
diff changeset
46 let b:eruby_nest_level = strlen(substitute(substitute(&filetype,'\C\<eruby\>','@','g'),'[^@]','','g'))
0f0bdbd8d37d Update syntax files
nanaya <me@nanaya.pro>
parents: 595
diff changeset
47 else
0f0bdbd8d37d Update syntax files
nanaya <me@nanaya.pro>
parents: 595
diff changeset
48 let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.\%(erb\|rhtml\)\>','@','g'),'[^@]','','g'))
0f0bdbd8d37d Update syntax files
nanaya <me@nanaya.pro>
parents: 595
diff changeset
49 endif
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
50 endif
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
51 if !b:eruby_nest_level
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
52 let b:eruby_nest_level = 1
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
53 endif
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
54
673
6cdd7d26260d [vim] Update syntaxes and colors
nanaya <me@nanaya.pro>
parents: 623
diff changeset
55 if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=? 'eruby'
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
56 exe "runtime! syntax/".b:eruby_subtype.".vim"
673
6cdd7d26260d [vim] Update syntaxes and colors
nanaya <me@nanaya.pro>
parents: 623
diff changeset
57 unlet! b:current_syntax
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
58 endif
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
59 syn include @rubyTop syntax/ruby.vim
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
60
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
61 syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
62
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
63 exe 'syn region erubyOneLiner matchgroup=erubyDelimiter start="^%\{1,'.b:eruby_nest_level.'\}%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
64 exe 'syn region erubyBlock matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}%\@!-\=" end="[=-]\=%\@<!%\{1,'.b:eruby_nest_level.'\}>" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
65 exe 'syn region erubyExpression matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}=\{1,4}" end="[=-]\=%\@<!%\{1,'.b:eruby_nest_level.'\}>" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
66 exe 'syn region erubyComment matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}-\=#" end="[=-]\=%\@<!%\{1,'.b:eruby_nest_level.'\}>" contains=rubyTodo,@Spell containedin=ALLBUT,@erubyRegions keepend'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
67
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
68 " Define the default highlighting.
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
69
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
70 hi def link erubyDelimiter PreProc
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
71 hi def link erubyComment Comment
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
72
673
6cdd7d26260d [vim] Update syntaxes and colors
nanaya <me@nanaya.pro>
parents: 623
diff changeset
73 let b:current_syntax = 'eruby'
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
74
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
75 if main_syntax == 'eruby'
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
76 unlet main_syntax
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
77 endif
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
78
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents:
diff changeset
79 " vim: nowrap sw=2 sts=2 ts=8: