annotate runtime/ftplugin/eruby.vim @ 33850:9fc745451034 v9.0.2136

patch 9.0.2136: MSVC errorformat can be improved Commit: https://github.com/vim/vim/commit/8ceb99001b52d0c642e7532763ec9d8217ee86e3 Author: Shawn Hatori <shawn.hatori@gmail.com> Date: Tue Nov 28 20:51:07 2023 +0100 patch 9.0.2136: MSVC errorformat can be improved Problem: MSVC errorformat can be improved Solution: parse error type and column number in MSVC errorformat closes: #13587 Signed-off-by: Shawn Hatori <shawn.hatori@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Tue, 28 Nov 2023 21:00:08 +0100
parents d3d82d3f6006
children 8ae680be2a51
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
529
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
1 " Vim filetype plugin
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: 3410
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>
33098
d3d82d3f6006 runtime(ruby): Update syntax, indent and ftplugin files
Christian Brabandt <cb@256bit.org>
parents: 25056
diff changeset
6 " Last Change: 2022 May 15
529
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
7
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
8 " Only do this when not done yet for this buffer
1205
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
9 if exists("b:did_ftplugin")
529
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
10 finish
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
11 endif
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
12
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
13 let s:save_cpo = &cpo
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
14 set cpo-=C
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
15
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
16 " Define some defaults in case the included ftplugins don't set them.
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
17 let s:undo_ftplugin = ""
1205
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
18 let s:browsefilter = "All Files (*.*)\t*.*\n"
529
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
19 let s:match_words = ""
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
20
1205
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
21 if !exists("g:eruby_default_subtype")
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
22 let g:eruby_default_subtype = "html"
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
23 endif
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
24
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3410
diff changeset
25 if &filetype =~ '^eruby\.'
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3410
diff changeset
26 let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+')
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3410
diff changeset
27 elseif !exists("b:eruby_subtype")
1205
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
28 let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
29 let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+')
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
30 if b:eruby_subtype == ''
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
31 let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\|\.example\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$')
1205
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
32 endif
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
33 if b:eruby_subtype == 'rhtml'
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
34 let b:eruby_subtype = 'html'
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
35 elseif b:eruby_subtype == 'rb'
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
36 let b:eruby_subtype = 'ruby'
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
37 elseif b:eruby_subtype == 'yml'
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
38 let b:eruby_subtype = 'yaml'
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
39 elseif b:eruby_subtype == 'js'
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
40 let b:eruby_subtype = 'javascript'
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
41 elseif b:eruby_subtype == 'txt'
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
42 " Conventional; not a real file type
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
43 let b:eruby_subtype = 'text'
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
44 elseif b:eruby_subtype == ''
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
45 let b:eruby_subtype = g:eruby_default_subtype
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
46 endif
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
47 endif
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
48
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
49 if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=? 'eruby'
1205
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
50 exe "runtime! ftplugin/".b:eruby_subtype.".vim ftplugin/".b:eruby_subtype."_*.vim ftplugin/".b:eruby_subtype."/*.vim"
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
51 else
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
52 runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
53 endif
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
54 unlet! b:did_ftplugin
529
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
55
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
56 " Override our defaults if these were set by an included ftplugin.
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
57 if exists("b:undo_ftplugin")
1205
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
58 let s:undo_ftplugin = b:undo_ftplugin
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
59 unlet b:undo_ftplugin
529
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
60 endif
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
61 if exists("b:browsefilter")
1205
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
62 let s:browsefilter = b:browsefilter
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
63 unlet b:browsefilter
529
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
64 endif
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
65 if exists("b:match_words")
1205
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
66 let s:match_words = b:match_words
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
67 unlet b:match_words
529
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
68 endif
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
69
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
70 let s:cfilemap = v:version >= 704 ? maparg('<Plug><cfile>', 'c', 0, 1) : {}
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
71 if !get(s:cfilemap, 'buffer') || !s:cfilemap.expr || s:cfilemap.rhs =~# 'ErubyAtCursor()'
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
72 let s:cfilemap = {}
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
73 endif
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
74 if !has_key(s:cfilemap, 'rhs')
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
75 let s:cfilemap.rhs = "substitute(&l:inex =~# '\\<v:fname\\>' && len(expand('<cfile>')) ? eval(substitute(&l:inex, '\\<v:fname\\>', '\\=string(expand(\"<cfile>\"))', 'g')) : '', '^$', \"\\022\\006\",'')"
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
76 endif
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
77 let s:ctagmap = v:version >= 704 ? maparg('<Plug><ctag>', 'c', 0, 1) : {}
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
78 if !get(s:ctagmap, 'buffer') || !s:ctagmap.expr || s:ctagmap.rhs =~# 'ErubyAtCursor()'
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
79 let s:ctagmap = {}
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
80 endif
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
81 let s:include = &l:include
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
82 let s:path = &l:path
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
83 let s:suffixesadd = &l:suffixesadd
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
84
529
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
85 runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
86 let b:did_ftplugin = 1
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
87
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
88 " Combine the new set of values with those previously included.
33098
d3d82d3f6006 runtime(ruby): Update syntax, indent and ftplugin files
Christian Brabandt <cb@256bit.org>
parents: 25056
diff changeset
89 if !exists('b:undo_ftplugin')
d3d82d3f6006 runtime(ruby): Update syntax, indent and ftplugin files
Christian Brabandt <cb@256bit.org>
parents: 25056
diff changeset
90 " No-op
d3d82d3f6006 runtime(ruby): Update syntax, indent and ftplugin files
Christian Brabandt <cb@256bit.org>
parents: 25056
diff changeset
91 let b:undo_ftplugin = 'exe'
d3d82d3f6006 runtime(ruby): Update syntax, indent and ftplugin files
Christian Brabandt <cb@256bit.org>
parents: 25056
diff changeset
92 endif
d3d82d3f6006 runtime(ruby): Update syntax, indent and ftplugin files
Christian Brabandt <cb@256bit.org>
parents: 25056
diff changeset
93 if !empty(s:undo_ftplugin)
d3d82d3f6006 runtime(ruby): Update syntax, indent and ftplugin files
Christian Brabandt <cb@256bit.org>
parents: 25056
diff changeset
94 let b:undo_ftplugin .= '|' . s:undo_ftplugin
529
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
95 endif
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
96 if exists ("b:browsefilter")
1205
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
97 let s:browsefilter = substitute(b:browsefilter,'\cAll Files (\*\.\*)\t\*\.\*\n','','') . s:browsefilter
529
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
98 endif
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
99 if exists("b:match_words")
1205
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
100 let s:match_words = b:match_words . ',' . s:match_words
529
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
101 endif
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
102
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
103 if len(s:include)
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
104 let &l:include = s:include
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
105 endif
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
106 let &l:path = s:path . (s:path =~# ',$\|^$' ? '' : ',') . &l:path
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
107 let &l:suffixesadd = s:suffixesadd . (s:suffixesadd =~# ',$\|^$' ? '' : ',') . &l:suffixesadd
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
108 exe 'cmap <buffer><script><expr> <Plug><cfile> ErubyAtCursor() ? ' . maparg('<Plug><cfile>', 'c') . ' : ' . s:cfilemap.rhs
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
109 exe 'cmap <buffer><script><expr> <Plug><ctag> ErubyAtCursor() ? ' . maparg('<Plug><ctag>', 'c') . ' : ' . get(s:ctagmap, 'rhs', '"\022\027"')
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
110 unlet s:cfilemap s:ctagmap s:include s:path s:suffixesadd
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
111
529
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
112 " Change the browse dialog on Win32 to show mainly eRuby-related files
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
113 if has("gui_win32")
1205
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
114 let b:browsefilter="eRuby Files (*.erb, *.rhtml)\t*.erb;*.rhtml\n" . s:browsefilter
529
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
115 endif
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
116
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
117 " Load the combined list of match_words for matchit.vim
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
118 if exists("loaded_matchit")
1205
b05620bdba29 updated for version 7.1b
vimboss
parents: 831
diff changeset
119 let b:match_words = s:match_words
529
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
120 endif
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
121
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
122 " TODO: comments=
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
123 setlocal commentstring=<%#%s%>
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
124
25056
43593a5d873f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
125 let b:undo_ftplugin = "setl cms< " .
33098
d3d82d3f6006 runtime(ruby): Update syntax, indent and ftplugin files
Christian Brabandt <cb@256bit.org>
parents: 25056
diff changeset
126 \ " | unlet! b:browsefilter b:match_words | " . b:undo_ftplugin
529
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
127
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
128 let &cpo = s:save_cpo
3410
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
129 unlet s:save_cpo
529
0d6092bb72e6 updated for version 7.0148
vimboss
parents:
diff changeset
130
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
131 function! ErubyAtCursor() abort
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
132 let groups = map(['erubyBlock', 'erubyComment', 'erubyExpression', 'erubyOneLiner'], 'hlID(v:val)')
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
133 return !empty(filter(synstack(line('.'), col('.')), 'index(groups, v:val) >= 0'))
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
134 endfunction
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
135
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1205
diff changeset
136 " vim: nowrap sw=2 sts=2 ts=8: