annotate runtime/syntax/eruby.vim @ 7467:765110dd332c v7.4.1036

commit https://github.com/vim/vim/commit/fa03fd6c4a9fe05274d62ddefd645cb5801d2023 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 2 22:03:00 2016 +0100 patch 7.4.1036 Problem: Only terminals with up to 256 colors work properly. Solution: Use the 256 color behavior for all terminals with 256 or more colors. (Robert de Bath, closes https://github.com/vim/vim/issues/504)
author Christian Brabandt <cb@256bit.org>
date Sat, 02 Jan 2016 22:15:04 +0100
parents a5352e73dc00
children 43efa4f5a8ea
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>
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
6
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7 if exists("b:current_syntax")
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
8 finish
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
9 endif
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
10
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
11 if !exists("main_syntax")
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
12 let main_syntax = 'eruby'
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
13 endif
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
14
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
15 if !exists("g:eruby_default_subtype")
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
16 let g:eruby_default_subtype = "html"
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
17 endif
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
18
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
19 if &filetype =~ '^eruby\.'
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
20 let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+')
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
21 elseif !exists("b:eruby_subtype") && main_syntax == 'eruby'
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
22 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
23 let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+')
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
24 if b:eruby_subtype == ''
2225
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
25 let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+$')
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
26 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
27 if b:eruby_subtype == 'rhtml'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
28 let b:eruby_subtype = 'html'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
29 elseif b:eruby_subtype == 'rb'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
30 let b:eruby_subtype = 'ruby'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
31 elseif b:eruby_subtype == 'yml'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
32 let b:eruby_subtype = 'yaml'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
33 elseif b:eruby_subtype == 'js'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
34 let b:eruby_subtype = 'javascript'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
35 elseif b:eruby_subtype == 'txt'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
36 " Conventional; not a real file type
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
37 let b:eruby_subtype = 'text'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
38 elseif b:eruby_subtype == ''
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
39 let b:eruby_subtype = g:eruby_default_subtype
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
40 endif
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
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
43 if !exists("b:eruby_nest_level")
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
44 let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.\%(erb\|rhtml\)\>','@','g'),'[^@]','','g'))
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
45 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
46 if !b:eruby_nest_level
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
47 let b:eruby_nest_level = 1
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
48 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
49
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
50 if exists("b:eruby_subtype") && b:eruby_subtype != ''
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
51 exe "runtime! syntax/".b:eruby_subtype.".vim"
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
52 unlet! b:current_syntax
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 syn include @rubyTop syntax/ruby.vim
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
55
530
339999b511a0 updated for version 7.0148
vimboss
parents: 497
diff changeset
56 syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment
339999b511a0 updated for version 7.0148
vimboss
parents: 497
diff changeset
57
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
58 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
59 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
60 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
61 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
62
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
63 " Define the default highlighting.
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
64
2225
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
65 hi def link erubyDelimiter PreProc
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
66 hi def link erubyComment Comment
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
67
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
68 let b:current_syntax = 'eruby'
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
69
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
70 if main_syntax == 'eruby'
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
71 unlet main_syntax
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
72 endif
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
73
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
74 " vim: nowrap sw=2 sts=2 ts=8: