annotate runtime/syntax/eruby.vim @ 29019:7cf98b61e022

Added tag v8.2.5031 for changeset 4a7650a894d4376260a962835646451aa5c79e09
author Bram Moolenaar <Bram@vim.org>
date Fri, 27 May 2022 21:15:03 +0200
parents e3d6184b89fa
children
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>
28246
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
6 " Last Change: 2022 Mar 18
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
7
28246
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
8 if exists("b:current_syntax")
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\+')
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
22 elseif !exists("b:eruby_subtype") && main_syntax == 'eruby'
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
23 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
24 let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+')
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
25 if b:eruby_subtype == ''
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
26 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
27 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
28 if b:eruby_subtype == 'rhtml'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
29 let b:eruby_subtype = 'html'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
30 elseif b:eruby_subtype == 'rb'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
31 let b:eruby_subtype = 'ruby'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
32 elseif b:eruby_subtype == 'yml'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
33 let b:eruby_subtype = 'yaml'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
34 elseif b:eruby_subtype == 'js'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
35 let b:eruby_subtype = 'javascript'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
36 elseif b:eruby_subtype == 'txt'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
37 " Conventional; not a real file type
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
38 let b:eruby_subtype = 'text'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
39 elseif b:eruby_subtype == ''
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
40 let b:eruby_subtype = g:eruby_default_subtype
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
41 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
42 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
43
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
44 if !exists("b:eruby_nest_level")
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
45 if &syntax =~# '\<eruby\.eruby\>'
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
46 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
47 else
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
48 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
49 endif
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
50 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
51 if !b:eruby_nest_level
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
52 let b:eruby_nest_level = 1
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
53 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
54
28246
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
55 if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=? 'eruby'
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
56 exe "runtime! syntax/".b:eruby_subtype.".vim"
28246
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
57 unlet! b:current_syntax
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
58 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
59 syn include @rubyTop syntax/ruby.vim
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
60
530
339999b511a0 updated for version 7.0148
vimboss
parents: 497
diff changeset
61 syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment
339999b511a0 updated for version 7.0148
vimboss
parents: 497
diff changeset
62
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
63 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
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'
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
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'
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
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'
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
67
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
68 " Define the default highlighting.
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
69
2225
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
70 hi def link erubyDelimiter PreProc
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
71 hi def link erubyComment Comment
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
72
28246
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
73 let b:current_syntax = 'eruby'
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
74
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
75 if main_syntax == 'eruby'
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
76 unlet main_syntax
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
77 endif
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
78
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
79 " vim: nowrap sw=2 sts=2 ts=8: