annotate runtime/syntax/eruby.vim @ 22891:2cf73a41bf09

Added tag v8.2.1992 for changeset 255473b88c8e704197fd02903171c57e084b103f
author Bram Moolenaar <Bram@vim.org>
date Sun, 15 Nov 2020 21:15:04 +0100
parents f0f06837a699
children e3d6184b89fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
1 " Vim syntax file
831
f24a95dae8ee updated for version 7.0d05
vimboss
parents: 557
diff changeset
2 " Language: eRuby
2225
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
4 " URL: https://github.com/vim-ruby/vim-ruby
831
f24a95dae8ee updated for version 7.0d05
vimboss
parents: 557
diff changeset
5 " Release Coordinator: Doug Kearns <dougkearns@gmail.com>
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
6 " Last Change: 2018 Jul 04
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
7
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
8 if &syntax !~# '\<eruby\>' || get(b:, 'current_syntax') =~# '\<eruby\>'
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
9 finish
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
10 endif
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
11
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
12 if !exists("main_syntax")
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
13 let main_syntax = 'eruby'
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
14 endif
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
15
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
16 if !exists("g:eruby_default_subtype")
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
17 let g:eruby_default_subtype = "html"
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
18 endif
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
19
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
20 if &filetype =~ '^eruby\.'
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
21 let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+')
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
22 elseif &filetype =~ '^.*\.eruby\>'
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
23 let b:eruby_subtype = matchstr(&filetype,'^.\{-\}\ze\.eruby\>')
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
24 elseif !exists("b:eruby_subtype") && main_syntax == 'eruby'
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
25 let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
26 let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+')
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
27 if b:eruby_subtype == ''
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
28 let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\|\.example\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$')
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
29 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
30 if b:eruby_subtype == 'rhtml'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
31 let b:eruby_subtype = 'html'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
32 elseif b:eruby_subtype == 'rb'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
33 let b:eruby_subtype = 'ruby'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
34 elseif b:eruby_subtype == 'yml'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
35 let b:eruby_subtype = 'yaml'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
36 elseif b:eruby_subtype == 'js'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
37 let b:eruby_subtype = 'javascript'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
38 elseif b:eruby_subtype == 'txt'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
39 " Conventional; not a real file type
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
40 let b:eruby_subtype = 'text'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
41 elseif b:eruby_subtype == ''
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
42 let b:eruby_subtype = g:eruby_default_subtype
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
43 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
44 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
45
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
46 if !exists("b:eruby_nest_level")
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
47 if &syntax =~# '\<eruby\.eruby\>'
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
48 let b:eruby_nest_level = strlen(substitute(substitute(&filetype,'\C\<eruby\>','@','g'),'[^@]','','g'))
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
49 else
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
50 let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.\%(erb\|rhtml\)\>','@','g'),'[^@]','','g'))
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
51 endif
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
52 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
53 if !b:eruby_nest_level
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
54 let b:eruby_nest_level = 1
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
55 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
56
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
57 if get(b:, 'eruby_subtype', '') !~# '^\%(eruby\)\=$' && &syntax =~# '^eruby\>'
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
58 exe "runtime! syntax/".b:eruby_subtype.".vim"
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
59 endif
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
60 unlet! b:current_syntax
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
61 syn include @rubyTop syntax/ruby.vim
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
62
530
339999b511a0 updated for version 7.0148
vimboss
parents: 497
diff changeset
63 syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment
339999b511a0 updated for version 7.0148
vimboss
parents: 497
diff changeset
64
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
65 exe 'syn region erubyOneLiner matchgroup=erubyDelimiter start="^%\{1,'.b:eruby_nest_level.'\}%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline'
2225
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
66 exe 'syn region erubyBlock matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}%\@!-\=" end="[=-]\=%\@<!%\{1,'.b:eruby_nest_level.'\}>" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend'
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
67 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'
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
68 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'
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
69
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
70 " Define the default highlighting.
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
71
2225
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
72 hi def link erubyDelimiter PreProc
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
73 hi def link erubyComment Comment
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
74
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
75 let b:current_syntax = matchstr(&syntax, '^.*\<eruby\>')
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
76
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
77 if main_syntax == 'eruby'
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
78 unlet main_syntax
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
79 endif
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
80
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
81 " vim: nowrap sw=2 sts=2 ts=8: