Mercurial > vim
annotate runtime/syntax/eruby.vim @ 13756:c38f29387245 v8.0.1750
patch 8.0.1750: crash when clearing loccation list in autocommand
commit https://github.com/vim/vim/commit/3b9474b4ad4d85b5396f7f641b436f193dc9d486
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Apr 23 21:29:48 2018 +0200
patch 8.0.1750: crash when clearing loccation list in autocommand
Problem: Crash when clearing loccation list in autocommand.
Solution: Check if "qi" equals "ql_info". (Yegappan Lakshmanan)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 23 Apr 2018 21:30:06 +0200 |
parents | 43efa4f5a8ea |
children | f0f06837a699 |
rev | line source |
---|---|
497 | 1 " Vim syntax file |
831 | 2 " Language: eRuby |
2225 | 3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> |
4869 | 4 " URL: https://github.com/vim-ruby/vim-ruby |
831 | 5 " Release Coordinator: Doug Kearns <dougkearns@gmail.com> |
497 | 6 |
1214 | 7 if exists("b:current_syntax") |
497 | 8 finish |
9 endif | |
10 | |
11 if !exists("main_syntax") | |
12 let main_syntax = 'eruby' | |
13 endif | |
14 | |
1214 | 15 if !exists("g:eruby_default_subtype") |
16 let g:eruby_default_subtype = "html" | |
497 | 17 endif |
18 | |
4869 | 19 if &filetype =~ '^eruby\.' |
20 let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+') | |
21 elseif !exists("b:eruby_subtype") && main_syntax == 'eruby' | |
1214 | 22 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\+') | |
24 if b:eruby_subtype == '' | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4869
diff
changeset
|
25 let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$') |
1214 | 26 endif |
27 if b:eruby_subtype == 'rhtml' | |
28 let b:eruby_subtype = 'html' | |
29 elseif b:eruby_subtype == 'rb' | |
30 let b:eruby_subtype = 'ruby' | |
31 elseif b:eruby_subtype == 'yml' | |
32 let b:eruby_subtype = 'yaml' | |
33 elseif b:eruby_subtype == 'js' | |
34 let b:eruby_subtype = 'javascript' | |
35 elseif b:eruby_subtype == 'txt' | |
36 " Conventional; not a real file type | |
37 let b:eruby_subtype = 'text' | |
38 elseif b:eruby_subtype == '' | |
39 let b:eruby_subtype = g:eruby_default_subtype | |
40 endif | |
41 endif | |
42 | |
43 if !exists("b:eruby_nest_level") | |
44 let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.\%(erb\|rhtml\)\>','@','g'),'[^@]','','g')) | |
45 endif | |
46 if !b:eruby_nest_level | |
47 let b:eruby_nest_level = 1 | |
48 endif | |
49 | |
50 if exists("b:eruby_subtype") && b:eruby_subtype != '' | |
51 exe "runtime! syntax/".b:eruby_subtype.".vim" | |
52 unlet! b:current_syntax | |
53 endif | |
54 syn include @rubyTop syntax/ruby.vim | |
55 | |
530 | 56 syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment |
57 | |
1668 | 58 exe 'syn region erubyOneLiner matchgroup=erubyDelimiter start="^%\{1,'.b:eruby_nest_level.'\}%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline' |
2225 | 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' |
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 | 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 | 62 |
63 " Define the default highlighting. | |
64 | |
2225 | 65 hi def link erubyDelimiter PreProc |
1668 | 66 hi def link erubyComment Comment |
497 | 67 |
1214 | 68 let b:current_syntax = 'eruby' |
497 | 69 |
70 if main_syntax == 'eruby' | |
71 unlet main_syntax | |
72 endif | |
73 | |
1668 | 74 " vim: nowrap sw=2 sts=2 ts=8: |