Mercurial > vim
annotate runtime/ftplugin/eruby.vim @ 7439:63a96fadf679 v7.4.1023
commit https://github.com/vim/vim/commit/2c15f6aa8fd057721e35d03523577b41cf7aaad5
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 2 15:00:30 2016 +0100
patch 7.4.1023
Problem: The distribution files for MS-Windows use CR-LF, which is
inconsistent with what one gets from github.
Solution: Use LF in the distribution files.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 02 Jan 2016 15:15:04 +0100 |
parents | a5352e73dc00 |
children | 43efa4f5a8ea |
rev | line source |
---|---|
529 | 1 " Vim filetype plugin |
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> |
529 | 6 |
7 " Only do this when not done yet for this buffer | |
1205 | 8 if exists("b:did_ftplugin") |
529 | 9 finish |
10 endif | |
11 | |
12 let s:save_cpo = &cpo | |
13 set cpo-=C | |
14 | |
15 " Define some defaults in case the included ftplugins don't set them. | |
16 let s:undo_ftplugin = "" | |
1205 | 17 let s:browsefilter = "All Files (*.*)\t*.*\n" |
529 | 18 let s:match_words = "" |
19 | |
1205 | 20 if !exists("g:eruby_default_subtype") |
21 let g:eruby_default_subtype = "html" | |
22 endif | |
23 | |
4869 | 24 if &filetype =~ '^eruby\.' |
25 let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+') | |
26 elseif !exists("b:eruby_subtype") | |
1205 | 27 let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") |
28 let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+') | |
29 if b:eruby_subtype == '' | |
2225 | 30 let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+$') |
1205 | 31 endif |
32 if b:eruby_subtype == 'rhtml' | |
33 let b:eruby_subtype = 'html' | |
34 elseif b:eruby_subtype == 'rb' | |
35 let b:eruby_subtype = 'ruby' | |
36 elseif b:eruby_subtype == 'yml' | |
37 let b:eruby_subtype = 'yaml' | |
38 elseif b:eruby_subtype == 'js' | |
39 let b:eruby_subtype = 'javascript' | |
40 elseif b:eruby_subtype == 'txt' | |
41 " Conventional; not a real file type | |
42 let b:eruby_subtype = 'text' | |
43 elseif b:eruby_subtype == '' | |
44 let b:eruby_subtype = g:eruby_default_subtype | |
45 endif | |
46 endif | |
47 | |
48 if exists("b:eruby_subtype") && b:eruby_subtype != '' | |
49 exe "runtime! ftplugin/".b:eruby_subtype.".vim ftplugin/".b:eruby_subtype."_*.vim ftplugin/".b:eruby_subtype."/*.vim" | |
50 else | |
51 runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim | |
52 endif | |
53 unlet! b:did_ftplugin | |
529 | 54 |
55 " Override our defaults if these were set by an included ftplugin. | |
56 if exists("b:undo_ftplugin") | |
1205 | 57 let s:undo_ftplugin = b:undo_ftplugin |
58 unlet b:undo_ftplugin | |
529 | 59 endif |
60 if exists("b:browsefilter") | |
1205 | 61 let s:browsefilter = b:browsefilter |
62 unlet b:browsefilter | |
529 | 63 endif |
64 if exists("b:match_words") | |
1205 | 65 let s:match_words = b:match_words |
66 unlet b:match_words | |
529 | 67 endif |
68 | |
69 runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim | |
70 let b:did_ftplugin = 1 | |
71 | |
72 " Combine the new set of values with those previously included. | |
73 if exists("b:undo_ftplugin") | |
1205 | 74 let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin |
529 | 75 endif |
76 if exists ("b:browsefilter") | |
1205 | 77 let s:browsefilter = substitute(b:browsefilter,'\cAll Files (\*\.\*)\t\*\.\*\n','','') . s:browsefilter |
529 | 78 endif |
79 if exists("b:match_words") | |
1205 | 80 let s:match_words = b:match_words . ',' . s:match_words |
529 | 81 endif |
82 | |
83 " Change the browse dialog on Win32 to show mainly eRuby-related files | |
84 if has("gui_win32") | |
1205 | 85 let b:browsefilter="eRuby Files (*.erb, *.rhtml)\t*.erb;*.rhtml\n" . s:browsefilter |
529 | 86 endif |
87 | |
88 " Load the combined list of match_words for matchit.vim | |
89 if exists("loaded_matchit") | |
1205 | 90 let b:match_words = s:match_words |
529 | 91 endif |
92 | |
93 " TODO: comments= | |
94 setlocal commentstring=<%#%s%> | |
95 | |
96 let b:undo_ftplugin = "setl cms< " | |
97 \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin | |
98 | |
99 let &cpo = s:save_cpo | |
3410
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
2225
diff
changeset
|
100 unlet s:save_cpo |
529 | 101 |
1620 | 102 " vim: nowrap sw=2 sts=2 ts=8: |