utils 0.0.67 → 0.0.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/bin/edit +3 -1
- data/lib/utils/editor.rb +14 -0
- data/lib/utils/version.rb +1 -1
- data/utils.gemspec +3 -3
- metadata +3 -74
- data/lib/utils/config/vim/after/syntax/haml.vim +0 -9
- data/lib/utils/config/vim/after/syntax/html.vim +0 -11
- data/lib/utils/config/vim/autoload/Align.vim +0 -1029
- data/lib/utils/config/vim/autoload/AlignMaps.vim +0 -330
- data/lib/utils/config/vim/autoload/ctrlp/bookmarkdir.vim +0 -139
- data/lib/utils/config/vim/autoload/ctrlp/buffertag.vim +0 -238
- data/lib/utils/config/vim/autoload/ctrlp/changes.vim +0 -96
- data/lib/utils/config/vim/autoload/ctrlp/dir.vim +0 -90
- data/lib/utils/config/vim/autoload/ctrlp/line.vim +0 -63
- data/lib/utils/config/vim/autoload/ctrlp/mixed.vim +0 -83
- data/lib/utils/config/vim/autoload/ctrlp/mrufiles.vim +0 -119
- data/lib/utils/config/vim/autoload/ctrlp/quickfix.vim +0 -62
- data/lib/utils/config/vim/autoload/ctrlp/rtscript.vim +0 -49
- data/lib/utils/config/vim/autoload/ctrlp/tag.vim +0 -112
- data/lib/utils/config/vim/autoload/ctrlp/undo.vim +0 -154
- data/lib/utils/config/vim/autoload/ctrlp/utils.vim +0 -72
- data/lib/utils/config/vim/autoload/ctrlp.vim +0 -1772
- data/lib/utils/config/vim/autoload/rails.vim +0 -4570
- data/lib/utils/config/vim/autoload/rubycomplete.vim +0 -801
- data/lib/utils/config/vim/autoload/sqlcomplete.vim +0 -741
- data/lib/utils/config/vim/autoload/vimball.vim +0 -750
- data/lib/utils/config/vim/colors/flori.vim +0 -116
- data/lib/utils/config/vim/compiler/coffee.vim +0 -68
- data/lib/utils/config/vim/compiler/eruby.vim +0 -40
- data/lib/utils/config/vim/compiler/ruby.vim +0 -67
- data/lib/utils/config/vim/compiler/rubyunit.vim +0 -34
- data/lib/utils/config/vim/doc/Decho.txt +0 -372
- data/lib/utils/config/vim/doc/coffee-script.txt +0 -116
- data/lib/utils/config/vim/doc/ctrlp.txt +0 -1113
- data/lib/utils/config/vim/doc/fugitive.txt +0 -257
- data/lib/utils/config/vim/doc/rails.txt +0 -1022
- data/lib/utils/config/vim/doc/xml-plugin.txt +0 -226
- data/lib/utils/config/vim/ftdetect/coffee.vim +0 -8
- data/lib/utils/config/vim/ftdetect/eco.vim +0 -1
- data/lib/utils/config/vim/ftdetect/ragel.vim +0 -2
- data/lib/utils/config/vim/ftdetect/ruby.vim +0 -17
- data/lib/utils/config/vim/ftdetect/slim.vim +0 -2
- data/lib/utils/config/vim/ftplugin/coffee.vim +0 -221
- data/lib/utils/config/vim/ftplugin/eruby.vim +0 -100
- data/lib/utils/config/vim/ftplugin/ruby.vim +0 -260
- data/lib/utils/config/vim/ftplugin/xml.vim +0 -941
- data/lib/utils/config/vim/indent/IndentAnything_html.vim +0 -35
- data/lib/utils/config/vim/indent/coffee.vim +0 -338
- data/lib/utils/config/vim/indent/eruby.vim +0 -77
- data/lib/utils/config/vim/indent/javascript.vim +0 -116
- data/lib/utils/config/vim/indent/ruby.vim +0 -377
- data/lib/utils/config/vim/indent/slim.vim +0 -75
- data/lib/utils/config/vim/plugin/AlignMapsPlugin.vim +0 -242
- data/lib/utils/config/vim/plugin/AlignPlugin.vim +0 -41
- data/lib/utils/config/vim/plugin/Decho.vim +0 -592
- data/lib/utils/config/vim/plugin/IndentAnything.vim +0 -675
- data/lib/utils/config/vim/plugin/bufexplorer.vim +0 -1144
- data/lib/utils/config/vim/plugin/cecutil.vim +0 -508
- data/lib/utils/config/vim/plugin/ctrlp.vim +0 -61
- data/lib/utils/config/vim/plugin/fugitive.vim +0 -2041
- data/lib/utils/config/vim/plugin/lusty-explorer.vim +0 -1509
- data/lib/utils/config/vim/plugin/rails.vim +0 -339
- data/lib/utils/config/vim/plugin/rubyextra.vim +0 -193
- data/lib/utils/config/vim/plugin/surround.vim +0 -628
- data/lib/utils/config/vim/plugin/taglist.vim +0 -4546
- data/lib/utils/config/vim/plugin/test/IndentAnything/test.js +0 -131
- data/lib/utils/config/vim/plugin/vimballPlugin.vim +0 -40
- data/lib/utils/config/vim/syntax/Decho.vim +0 -101
- data/lib/utils/config/vim/syntax/coffee.vim +0 -217
- data/lib/utils/config/vim/syntax/eco.vim +0 -62
- data/lib/utils/config/vim/syntax/eruby.vim +0 -73
- data/lib/utils/config/vim/syntax/javascript.vim +0 -246
- data/lib/utils/config/vim/syntax/ragel.vim +0 -165
- data/lib/utils/config/vim/syntax/ruby.vim +0 -367
- data/lib/utils/config/vim/syntax/slim.vim +0 -117
- data/lib/utils/config/vimrc +0 -540
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
*xml-plugin.txt* Help edit XML and SGML documents. v78
|
|
2
|
-
|
|
3
|
-
XML Edit ~
|
|
4
|
-
|
|
5
|
-
A filetype plugin to help edit XML and SGML documents.
|
|
6
|
-
|
|
7
|
-
This script provides some convenience when editing XML (and some SGML
|
|
8
|
-
including HTML) formated documents. It allows you to jump to the beginning
|
|
9
|
-
or end of the tag block your cursor is in. '%' will jump between '<' and '>'
|
|
10
|
-
within the tag your cursor is in. When in insert mode and you finish a tag
|
|
11
|
-
(pressing '>') the tag will be completed. If you press '>' twice it will
|
|
12
|
-
complete the tag and place the cursor in the middle of the tags on it's own
|
|
13
|
-
line (helps with nested tags).
|
|
14
|
-
|
|
15
|
-
Usage: Place this file into your ftplugin directory. To add html support
|
|
16
|
-
Sym-link or copy this file to html.vim in your ftplugin directory. To activte
|
|
17
|
-
the script place 'filetype plugin on' in your |.vimrc| file. See |ftplugins|
|
|
18
|
-
for more information on this topic.
|
|
19
|
-
|
|
20
|
-
If the file edited is of type "html" and "xml_use_html" is defined then the
|
|
21
|
-
following tags will not auto complete:
|
|
22
|
-
<img>, <input>, <param>, <frame>, <br>, <hr>, <meta>, <link>, <base>, <area>
|
|
23
|
-
|
|
24
|
-
If the file edited is of type 'html' and 'xml_use_xhtml' is defined the above
|
|
25
|
-
tags will autocomplete the xml closing staying xhtml compatable.
|
|
26
|
-
ex. <hr> becomes <hr /> (see |xml-plugin-settings|)
|
|
27
|
-
|
|
28
|
-
NOTE: If you used the VIM 5.x version of this file (xmledit.vim) you'll need
|
|
29
|
-
to comment out the section where you called it. It is no longer used in the
|
|
30
|
-
VIM 6.x version.
|
|
31
|
-
|
|
32
|
-
Known Bugs ~
|
|
33
|
-
|
|
34
|
-
- This script will modify registers ". and "x; register "" will be restored.
|
|
35
|
-
- < & > marks inside of a CDATA section are interpreted as actual XML tags
|
|
36
|
-
even if unmatched.
|
|
37
|
-
- Although the script can handle leading spaces such as < tag></ tag> it is
|
|
38
|
-
illegal XML syntax and considered very bad form.
|
|
39
|
-
- Placing a literal `>' in an attribute value will auto complete dispite that
|
|
40
|
-
the start tag isn't finished. This is poor XML anyway you should use
|
|
41
|
-
> instead.
|
|
42
|
-
- The matching algorithm can handle illegal tag characters where as the tag
|
|
43
|
-
completion algorithm can not.
|
|
44
|
-
|
|
45
|
-
------------------------------------------------------------------------------
|
|
46
|
-
*xml-plugin-mappings*
|
|
47
|
-
Mappings ~
|
|
48
|
-
|
|
49
|
-
<LocalLeader> is a setting in VIM that depicts a prefix for scripts and
|
|
50
|
-
plugins to use. By default this is the backslash key `\'. See |mapleader|
|
|
51
|
-
for details.
|
|
52
|
-
|
|
53
|
-
<LocalLeader>Space
|
|
54
|
-
Normal or Insert - Continue editing after the ending tag. This
|
|
55
|
-
option requires xml_jump_string to be set to function. When a tag
|
|
56
|
-
is completed it will append the xml_jump_string. Once this mapping
|
|
57
|
-
is ran it will delete the next xml_jump_string pattern to the right
|
|
58
|
-
of the curser and delete it leaving you in insert mode to continue
|
|
59
|
-
editing.
|
|
60
|
-
|
|
61
|
-
<LocalLeader><LocalLeader>
|
|
62
|
-
Normal - Will clear the entire file of left over xml_jump_string garbage.
|
|
63
|
-
* This will also happen automatically when you save the file. *
|
|
64
|
-
|
|
65
|
-
<LocalLeader>x
|
|
66
|
-
Visual - Place a custom XML tag to suround the selected text. You
|
|
67
|
-
need to have selected text in visual mode before you can use this
|
|
68
|
-
mapping. See |visual-mode| for details.
|
|
69
|
-
|
|
70
|
-
<LocalLeader>. or <LocalLeader>>
|
|
71
|
-
Insert - Place a literal '>' without parsing tag.
|
|
72
|
-
|
|
73
|
-
<LocalLeader>5 or <LocalLeader>%
|
|
74
|
-
Normal or Visual - Jump to the begining or end tag.
|
|
75
|
-
|
|
76
|
-
<LocalLeader>d
|
|
77
|
-
Normal - Deletes the surrounding tags from the cursor. >
|
|
78
|
-
<tag1>outter <tag2>inner text</tag2> text</tag1>
|
|
79
|
-
^
|
|
80
|
-
< Turns to: >
|
|
81
|
-
outter <tag2>inner text</tag2> text
|
|
82
|
-
^
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
------------------------------------------------------------------------------
|
|
86
|
-
*xml-plugin-settings*
|
|
87
|
-
Options ~
|
|
88
|
-
|
|
89
|
-
(All options must be placed in your |.vimrc| prior to the |ftplugin|
|
|
90
|
-
command.)
|
|
91
|
-
|
|
92
|
-
xml_tag_completion_map
|
|
93
|
-
Use this setting to change the default mapping to auto complete a
|
|
94
|
-
tag. By default typing a literal `>' will cause the tag your editing
|
|
95
|
-
to auto complete; pressing twice will auto nest the tag. By using
|
|
96
|
-
this setting the `>' will be a literal `>' and you must use the new
|
|
97
|
-
mapping to perform auto completion and auto nesting. For example if
|
|
98
|
-
you wanted Control-L to perform auto completion inmstead of typing a
|
|
99
|
-
`>' place the following into your .vimrc: >
|
|
100
|
-
let xml_tag_completion_map = "<C-l>"
|
|
101
|
-
<
|
|
102
|
-
xml_no_auto_nesting
|
|
103
|
-
This turns off the auto nesting feature. After a completion is made
|
|
104
|
-
and another `>' is typed xml-edit automatically will break the tag
|
|
105
|
-
accross multiple lines and indent the curser to make creating nested
|
|
106
|
-
tqags easier. This feature turns it off. Enter the following in your
|
|
107
|
-
.vimrc: >
|
|
108
|
-
let xml_no_auto_nesting = 1
|
|
109
|
-
<
|
|
110
|
-
xml_use_xhtml
|
|
111
|
-
When editing HTML this will auto close the short tags to make valid
|
|
112
|
-
XML like <hr /> and <br />. Enter the following in your vimrc to
|
|
113
|
-
turn this option on: >
|
|
114
|
-
let xml_use_xhtml = 1
|
|
115
|
-
<
|
|
116
|
-
xml_no_html
|
|
117
|
-
This turns of the support for HTML specific tags. Place this in your
|
|
118
|
-
.vimrc: >
|
|
119
|
-
let xml_no_html = 1
|
|
120
|
-
<
|
|
121
|
-
xml_jump_string
|
|
122
|
-
This turns of the support for continuing edits after an ending tag.
|
|
123
|
-
xml_jump_string can be any string how ever a simple character will
|
|
124
|
-
serfice. Pick a character or small string that is unique and will
|
|
125
|
-
not interfer with your normal editing. See the <LocalLeader>Space
|
|
126
|
-
mapping for more.
|
|
127
|
-
.vimrc: >
|
|
128
|
-
let xml_jump_string = "`"
|
|
129
|
-
<
|
|
130
|
-
------------------------------------------------------------------------------
|
|
131
|
-
*xml-plugin-callbacks*
|
|
132
|
-
Callback Functions ~
|
|
133
|
-
|
|
134
|
-
A callback function is a function used to customize features on a per tag
|
|
135
|
-
basis. For example say you wish to have a default set of attributs when you
|
|
136
|
-
type an empty tag like this:
|
|
137
|
-
You type: <tag>
|
|
138
|
-
You get: <tag default="attributes"></tag>
|
|
139
|
-
|
|
140
|
-
This is for any script programmers who wish to add xml-plugin support to
|
|
141
|
-
there own filetype plugins.
|
|
142
|
-
|
|
143
|
-
Callback functions recive one attribute variable which is the tag name. The
|
|
144
|
-
all must return either a string or the number zero. If it returns a string
|
|
145
|
-
the plugin will place the string in the proper location. If it is a zero the
|
|
146
|
-
plugin will ignore and continue as if no callback existed.
|
|
147
|
-
|
|
148
|
-
The following are implemented callback functions:
|
|
149
|
-
|
|
150
|
-
HtmlAttribCallback
|
|
151
|
-
This is used to add default attributes to html tag. It is intended
|
|
152
|
-
for HTML files only.
|
|
153
|
-
|
|
154
|
-
XmlAttribCallback
|
|
155
|
-
This is a generic callback for xml tags intended to add attributes.
|
|
156
|
-
|
|
157
|
-
*xml-plugin-html*
|
|
158
|
-
Callback Example ~
|
|
159
|
-
|
|
160
|
-
The following is an example of using XmlAttribCallback in your .vimrc
|
|
161
|
-
>
|
|
162
|
-
function XmlAttribCallback (xml_tag)
|
|
163
|
-
if a:xml_tag ==? "my-xml-tag"
|
|
164
|
-
return "attributes=\"my xml attributes\""
|
|
165
|
-
else
|
|
166
|
-
return 0
|
|
167
|
-
endif
|
|
168
|
-
endfunction
|
|
169
|
-
<
|
|
170
|
-
The following is a sample html.vim file type plugin you could use:
|
|
171
|
-
>
|
|
172
|
-
" Vim script file vim600:fdm=marker:
|
|
173
|
-
" FileType: HTML
|
|
174
|
-
" Maintainer: Devin Weaver <vim (at) tritarget.com>
|
|
175
|
-
" Location: http://www.vim.org/scripts/script.php?script_id=301
|
|
176
|
-
|
|
177
|
-
" This is a wrapper script to add extra html support to xml documents.
|
|
178
|
-
" Original script can be seen in xml-plugin documentation.
|
|
179
|
-
|
|
180
|
-
" Only do this when not done yet for this buffer
|
|
181
|
-
if exists("b:did_ftplugin")
|
|
182
|
-
finish
|
|
183
|
-
endif
|
|
184
|
-
" Don't set 'b:did_ftplugin = 1' because that is xml.vim's responsability.
|
|
185
|
-
|
|
186
|
-
let b:html_mode = 1
|
|
187
|
-
|
|
188
|
-
if !exists("*HtmlAttribCallback")
|
|
189
|
-
function HtmlAttribCallback( xml_tag )
|
|
190
|
-
if a:xml_tag ==? "table"
|
|
191
|
-
return "cellpadding=\"0\" cellspacing=\"0\" border=\"0\""
|
|
192
|
-
elseif a:xml_tag ==? "link"
|
|
193
|
-
return "href=\"/site.css\" rel=\"StyleSheet\" type=\"text/css\""
|
|
194
|
-
elseif a:xml_tag ==? "body"
|
|
195
|
-
return "bgcolor=\"white\""
|
|
196
|
-
elseif a:xml_tag ==? "frame"
|
|
197
|
-
return "name=\"NAME\" src=\"/\" scrolling=\"auto\" noresize"
|
|
198
|
-
elseif a:xml_tag ==? "frameset"
|
|
199
|
-
return "rows=\"0,*\" cols=\"*,0\" border=\"0\""
|
|
200
|
-
elseif a:xml_tag ==? "img"
|
|
201
|
-
return "src=\"\" width=\"0\" height=\"0\" border=\"0\" alt=\"\""
|
|
202
|
-
elseif a:xml_tag ==? "a"
|
|
203
|
-
if has("browse")
|
|
204
|
-
" Look up a file to fill the href. Used in local relative file
|
|
205
|
-
" links. typeing your own href before closing the tag with `>'
|
|
206
|
-
" will override this.
|
|
207
|
-
let cwd = getcwd()
|
|
208
|
-
let cwd = substitute (cwd, "\\", "/", "g")
|
|
209
|
-
let href = browse (0, "Link to href...", getcwd(), "")
|
|
210
|
-
let href = substitute (href, cwd . "/", "", "")
|
|
211
|
-
let href = substitute (href, " ", "%20", "g")
|
|
212
|
-
else
|
|
213
|
-
let href = ""
|
|
214
|
-
endif
|
|
215
|
-
return "href=\"" . href . "\""
|
|
216
|
-
else
|
|
217
|
-
return 0
|
|
218
|
-
endif
|
|
219
|
-
endfunction
|
|
220
|
-
endif
|
|
221
|
-
|
|
222
|
-
" On to loading xml.vim
|
|
223
|
-
runtime ftplugin/xml.vim
|
|
224
|
-
<
|
|
225
|
-
|
|
226
|
-
vim:tw=78:ts=8:ft=help:norl:
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
" Language: CoffeeScript
|
|
2
|
-
" Maintainer: Mick Koch <kchmck@gmail.com>
|
|
3
|
-
" URL: http://github.com/kchmck/vim-coffee-script
|
|
4
|
-
" License: WTFPL
|
|
5
|
-
|
|
6
|
-
autocmd BufNewFile,BufRead *.coffee set filetype=coffee
|
|
7
|
-
autocmd BufNewFile,BufRead *Cakefile set filetype=coffee
|
|
8
|
-
autocmd BufNewFile,BufRead *.coffeekup set filetype=coffee
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
autocmd BufNewFile,BufRead *.eco set filetype=eco
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
" Ruby
|
|
2
|
-
au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec set filetype=ruby
|
|
3
|
-
|
|
4
|
-
" Ruby on Rails
|
|
5
|
-
au BufNewFile,BufRead *.builder,*.rxml,*.rjs set filetype=ruby
|
|
6
|
-
|
|
7
|
-
" Rakefile
|
|
8
|
-
au BufNewFile,BufRead [rR]akefile,*.rake set filetype=ruby
|
|
9
|
-
|
|
10
|
-
" Rantfile
|
|
11
|
-
au BufNewFile,BufRead [rR]antfile,*.rant set filetype=ruby
|
|
12
|
-
|
|
13
|
-
" IRB config
|
|
14
|
-
au BufNewFile,BufRead .irbrc,irbrc set filetype=ruby
|
|
15
|
-
|
|
16
|
-
" eRuby
|
|
17
|
-
au BufNewFile,BufRead *.erb,*.rhtml set filetype=eruby
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
" Language: CoffeeScript
|
|
2
|
-
" Maintainer: Mick Koch <kchmck@gmail.com>
|
|
3
|
-
" URL: http://github.com/kchmck/vim-coffee-script
|
|
4
|
-
" License: WTFPL
|
|
5
|
-
|
|
6
|
-
if exists("b:did_ftplugin")
|
|
7
|
-
finish
|
|
8
|
-
endif
|
|
9
|
-
|
|
10
|
-
let b:did_ftplugin = 1
|
|
11
|
-
|
|
12
|
-
setlocal formatoptions-=t formatoptions+=croql
|
|
13
|
-
setlocal comments=:#
|
|
14
|
-
setlocal commentstring=#\ %s
|
|
15
|
-
setlocal omnifunc=javascriptcomplete#CompleteJS
|
|
16
|
-
|
|
17
|
-
" Enable CoffeeMake if it won't overwrite any settings.
|
|
18
|
-
if !len(&l:makeprg)
|
|
19
|
-
compiler coffee
|
|
20
|
-
endif
|
|
21
|
-
|
|
22
|
-
" Reset the global variables used by CoffeeCompile.
|
|
23
|
-
function! s:CoffeeCompileResetVars()
|
|
24
|
-
" Position in the source buffer
|
|
25
|
-
let s:coffee_compile_src_buf = -1
|
|
26
|
-
let s:coffee_compile_src_pos = []
|
|
27
|
-
|
|
28
|
-
" Position in the CoffeeCompile buffer
|
|
29
|
-
let s:coffee_compile_buf = -1
|
|
30
|
-
let s:coffee_compile_win = -1
|
|
31
|
-
let s:coffee_compile_pos = []
|
|
32
|
-
|
|
33
|
-
" If CoffeeCompile is watching a buffer
|
|
34
|
-
let s:coffee_compile_watch = 0
|
|
35
|
-
endfunction
|
|
36
|
-
|
|
37
|
-
" Save the cursor position when moving to and from the CoffeeCompile buffer.
|
|
38
|
-
function! s:CoffeeCompileSavePos()
|
|
39
|
-
let buf = bufnr('%')
|
|
40
|
-
let pos = getpos('.')
|
|
41
|
-
|
|
42
|
-
if buf == s:coffee_compile_buf
|
|
43
|
-
let s:coffee_compile_pos = pos
|
|
44
|
-
else
|
|
45
|
-
let s:coffee_compile_src_buf = buf
|
|
46
|
-
let s:coffee_compile_src_pos = pos
|
|
47
|
-
endif
|
|
48
|
-
endfunction
|
|
49
|
-
|
|
50
|
-
" Restore the cursor to the source buffer.
|
|
51
|
-
function! s:CoffeeCompileRestorePos()
|
|
52
|
-
let win = bufwinnr(s:coffee_compile_src_buf)
|
|
53
|
-
|
|
54
|
-
if win != -1
|
|
55
|
-
exec win 'wincmd w'
|
|
56
|
-
call setpos('.', s:coffee_compile_src_pos)
|
|
57
|
-
endif
|
|
58
|
-
endfunction
|
|
59
|
-
|
|
60
|
-
" Close the CoffeeCompile buffer and clean things up.
|
|
61
|
-
function! s:CoffeeCompileClose()
|
|
62
|
-
silent! autocmd! CoffeeCompileAuPos
|
|
63
|
-
silent! autocmd! CoffeeCompileAuWatch
|
|
64
|
-
|
|
65
|
-
call s:CoffeeCompileRestorePos()
|
|
66
|
-
call s:CoffeeCompileResetVars()
|
|
67
|
-
endfunction
|
|
68
|
-
|
|
69
|
-
" Update the CoffeeCompile buffer given some input lines.
|
|
70
|
-
function! s:CoffeeCompileUpdate(startline, endline)
|
|
71
|
-
let input = join(getline(a:startline, a:endline), "\n")
|
|
72
|
-
|
|
73
|
-
" Coffee doesn't like empty input.
|
|
74
|
-
if !len(input)
|
|
75
|
-
return
|
|
76
|
-
endif
|
|
77
|
-
|
|
78
|
-
" Compile input.
|
|
79
|
-
let output = system('coffee -scb 2>&1', input)
|
|
80
|
-
|
|
81
|
-
" Move to the CoffeeCompile buffer.
|
|
82
|
-
exec s:coffee_compile_win 'wincmd w'
|
|
83
|
-
|
|
84
|
-
" Replace buffer contents with new output and delete the last empty line.
|
|
85
|
-
setlocal modifiable
|
|
86
|
-
exec '% delete _'
|
|
87
|
-
put! =output
|
|
88
|
-
exec '$ delete _'
|
|
89
|
-
setlocal nomodifiable
|
|
90
|
-
|
|
91
|
-
" Highlight as JavaScript if there is no compile error.
|
|
92
|
-
if v:shell_error
|
|
93
|
-
setlocal filetype=
|
|
94
|
-
else
|
|
95
|
-
setlocal filetype=javascript
|
|
96
|
-
endif
|
|
97
|
-
|
|
98
|
-
" Restore the cursor in the compiled output.
|
|
99
|
-
call setpos('.', s:coffee_compile_pos)
|
|
100
|
-
endfunction
|
|
101
|
-
|
|
102
|
-
" Update the CoffeeCompile buffer with the whole source buffer and restore the
|
|
103
|
-
" cursor.
|
|
104
|
-
function! s:CoffeeCompileWatchUpdate()
|
|
105
|
-
call s:CoffeeCompileSavePos()
|
|
106
|
-
call s:CoffeeCompileUpdate(1, '$')
|
|
107
|
-
call s:CoffeeCompileRestorePos()
|
|
108
|
-
endfunction
|
|
109
|
-
|
|
110
|
-
" Peek at compiled CoffeeScript in a scratch buffer. We handle ranges like this
|
|
111
|
-
" to prevent the cursor from being moved (and its position saved) before the
|
|
112
|
-
" function is called.
|
|
113
|
-
function! s:CoffeeCompile(startline, endline, args)
|
|
114
|
-
" Don't compile the CoffeeCompile buffer.
|
|
115
|
-
if bufnr('%') == s:coffee_compile_buf
|
|
116
|
-
return
|
|
117
|
-
endif
|
|
118
|
-
|
|
119
|
-
" Parse arguments.
|
|
120
|
-
let watch = a:args =~ '\<watch\>'
|
|
121
|
-
let unwatch = a:args =~ '\<unwatch\>'
|
|
122
|
-
let size = str2nr(matchstr(a:args, '\<\d\+\>'))
|
|
123
|
-
|
|
124
|
-
" Determine default split direction.
|
|
125
|
-
if exists("g:coffee_compile_vert")
|
|
126
|
-
let vert = 1
|
|
127
|
-
else
|
|
128
|
-
let vert = a:args =~ '\<vert\%[ical]\>'
|
|
129
|
-
endif
|
|
130
|
-
|
|
131
|
-
" Remove any watch listeners.
|
|
132
|
-
silent! autocmd! CoffeeCompileAuWatch
|
|
133
|
-
|
|
134
|
-
" If just unwatching, don't compile.
|
|
135
|
-
if unwatch
|
|
136
|
-
let s:coffee_compile_watch = 0
|
|
137
|
-
return
|
|
138
|
-
endif
|
|
139
|
-
|
|
140
|
-
if watch
|
|
141
|
-
let s:coffee_compile_watch = 1
|
|
142
|
-
endif
|
|
143
|
-
|
|
144
|
-
call s:CoffeeCompileSavePos()
|
|
145
|
-
|
|
146
|
-
" Build the CoffeeCompile buffer if it doesn't exist.
|
|
147
|
-
if s:coffee_compile_buf == -1
|
|
148
|
-
let src_win = bufwinnr(s:coffee_compile_src_buf)
|
|
149
|
-
|
|
150
|
-
" Create the new window and resize it.
|
|
151
|
-
if vert
|
|
152
|
-
let width = size ? size : winwidth(src_win) / 2
|
|
153
|
-
|
|
154
|
-
vertical new
|
|
155
|
-
exec 'vertical resize' width
|
|
156
|
-
else
|
|
157
|
-
" Try to guess the compiled output's height.
|
|
158
|
-
let height = size ? size : min([winheight(src_win) / 2,
|
|
159
|
-
\ a:endline - a:startline + 2])
|
|
160
|
-
|
|
161
|
-
botright new
|
|
162
|
-
exec 'resize' height
|
|
163
|
-
endif
|
|
164
|
-
|
|
165
|
-
" Set up scratch buffer.
|
|
166
|
-
setlocal bufhidden=wipe buftype=nofile
|
|
167
|
-
setlocal nobuflisted nomodifiable noswapfile nowrap
|
|
168
|
-
|
|
169
|
-
autocmd BufWipeout <buffer> call s:CoffeeCompileClose()
|
|
170
|
-
nnoremap <buffer> <silent> q :hide<CR>
|
|
171
|
-
|
|
172
|
-
" Save the cursor position on each buffer switch.
|
|
173
|
-
augroup CoffeeCompileAuPos
|
|
174
|
-
autocmd BufEnter,BufLeave * call s:CoffeeCompileSavePos()
|
|
175
|
-
augroup END
|
|
176
|
-
|
|
177
|
-
let s:coffee_compile_buf = bufnr('%')
|
|
178
|
-
let s:coffee_compile_win = bufwinnr(s:coffee_compile_buf)
|
|
179
|
-
endif
|
|
180
|
-
|
|
181
|
-
" Go back to the source buffer and do the initial compile.
|
|
182
|
-
call s:CoffeeCompileRestorePos()
|
|
183
|
-
|
|
184
|
-
if s:coffee_compile_watch
|
|
185
|
-
call s:CoffeeCompileWatchUpdate()
|
|
186
|
-
|
|
187
|
-
augroup CoffeeCompileAuWatch
|
|
188
|
-
autocmd InsertLeave <buffer> call s:CoffeeCompileWatchUpdate()
|
|
189
|
-
augroup END
|
|
190
|
-
else
|
|
191
|
-
call s:CoffeeCompileUpdate(a:startline, a:endline)
|
|
192
|
-
endif
|
|
193
|
-
endfunction
|
|
194
|
-
|
|
195
|
-
" Complete arguments for the CoffeeCompile command.
|
|
196
|
-
function! s:CoffeeCompileComplete(arg, cmdline, cursor)
|
|
197
|
-
let args = ['unwatch', 'vertical', 'watch']
|
|
198
|
-
|
|
199
|
-
if !len(a:arg)
|
|
200
|
-
return args
|
|
201
|
-
endif
|
|
202
|
-
|
|
203
|
-
let match = '^' . a:arg
|
|
204
|
-
|
|
205
|
-
for arg in args
|
|
206
|
-
if arg =~ match
|
|
207
|
-
return [arg]
|
|
208
|
-
endif
|
|
209
|
-
endfor
|
|
210
|
-
endfunction
|
|
211
|
-
|
|
212
|
-
" Don't let new windows overwrite the CoffeeCompile variables.
|
|
213
|
-
if !exists("s:coffee_compile_buf")
|
|
214
|
-
call s:CoffeeCompileResetVars()
|
|
215
|
-
endif
|
|
216
|
-
|
|
217
|
-
" Peek at compiled CoffeeScript.
|
|
218
|
-
command! -range=% -bar -nargs=* -complete=customlist,s:CoffeeCompileComplete
|
|
219
|
-
\ CoffeeCompile call s:CoffeeCompile(<line1>, <line2>, <q-args>)
|
|
220
|
-
" Run some CoffeeScript.
|
|
221
|
-
command! -range=% -bar CoffeeRun <line1>,<line2>:w !coffee -s
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
" Vim filetype plugin
|
|
2
|
-
" Language: eRuby
|
|
3
|
-
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
|
4
|
-
" URL: http://vim-ruby.rubyforge.org
|
|
5
|
-
" Anon CVS: See above site
|
|
6
|
-
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
|
|
7
|
-
|
|
8
|
-
" Only do this when not done yet for this buffer
|
|
9
|
-
if exists("b:did_ftplugin")
|
|
10
|
-
finish
|
|
11
|
-
endif
|
|
12
|
-
|
|
13
|
-
let s:save_cpo = &cpo
|
|
14
|
-
set cpo-=C
|
|
15
|
-
|
|
16
|
-
" Define some defaults in case the included ftplugins don't set them.
|
|
17
|
-
let s:undo_ftplugin = ""
|
|
18
|
-
let s:browsefilter = "All Files (*.*)\t*.*\n"
|
|
19
|
-
let s:match_words = ""
|
|
20
|
-
|
|
21
|
-
if !exists("g:eruby_default_subtype")
|
|
22
|
-
let g:eruby_default_subtype = "html"
|
|
23
|
-
endif
|
|
24
|
-
|
|
25
|
-
if !exists("b:eruby_subtype")
|
|
26
|
-
let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
|
|
27
|
-
let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+')
|
|
28
|
-
if b:eruby_subtype == ''
|
|
29
|
-
let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\)\+$','',''),'\.\zs\w\+$')
|
|
30
|
-
endif
|
|
31
|
-
if b:eruby_subtype == 'rhtml'
|
|
32
|
-
let b:eruby_subtype = 'html'
|
|
33
|
-
elseif b:eruby_subtype == 'rb'
|
|
34
|
-
let b:eruby_subtype = 'ruby'
|
|
35
|
-
elseif b:eruby_subtype == 'yml'
|
|
36
|
-
let b:eruby_subtype = 'yaml'
|
|
37
|
-
elseif b:eruby_subtype == 'js'
|
|
38
|
-
let b:eruby_subtype = 'javascript'
|
|
39
|
-
elseif b:eruby_subtype == 'txt'
|
|
40
|
-
" Conventional; not a real file type
|
|
41
|
-
let b:eruby_subtype = 'text'
|
|
42
|
-
elseif b:eruby_subtype == ''
|
|
43
|
-
let b:eruby_subtype = g:eruby_default_subtype
|
|
44
|
-
endif
|
|
45
|
-
endif
|
|
46
|
-
|
|
47
|
-
if exists("b:eruby_subtype") && b:eruby_subtype != ''
|
|
48
|
-
exe "runtime! ftplugin/".b:eruby_subtype.".vim ftplugin/".b:eruby_subtype."_*.vim ftplugin/".b:eruby_subtype."/*.vim"
|
|
49
|
-
else
|
|
50
|
-
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
|
|
51
|
-
endif
|
|
52
|
-
unlet! b:did_ftplugin
|
|
53
|
-
|
|
54
|
-
" Override our defaults if these were set by an included ftplugin.
|
|
55
|
-
if exists("b:undo_ftplugin")
|
|
56
|
-
let s:undo_ftplugin = b:undo_ftplugin
|
|
57
|
-
unlet b:undo_ftplugin
|
|
58
|
-
endif
|
|
59
|
-
if exists("b:browsefilter")
|
|
60
|
-
let s:browsefilter = b:browsefilter
|
|
61
|
-
unlet b:browsefilter
|
|
62
|
-
endif
|
|
63
|
-
if exists("b:match_words")
|
|
64
|
-
let s:match_words = b:match_words
|
|
65
|
-
unlet b:match_words
|
|
66
|
-
endif
|
|
67
|
-
|
|
68
|
-
runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim
|
|
69
|
-
let b:did_ftplugin = 1
|
|
70
|
-
|
|
71
|
-
" Combine the new set of values with those previously included.
|
|
72
|
-
if exists("b:undo_ftplugin")
|
|
73
|
-
let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin
|
|
74
|
-
endif
|
|
75
|
-
if exists ("b:browsefilter")
|
|
76
|
-
let s:browsefilter = substitute(b:browsefilter,'\cAll Files (\*\.\*)\t\*\.\*\n','','') . s:browsefilter
|
|
77
|
-
endif
|
|
78
|
-
if exists("b:match_words")
|
|
79
|
-
let s:match_words = b:match_words . ',' . s:match_words
|
|
80
|
-
endif
|
|
81
|
-
|
|
82
|
-
" Change the browse dialog on Win32 to show mainly eRuby-related files
|
|
83
|
-
if has("gui_win32")
|
|
84
|
-
let b:browsefilter="eRuby Files (*.erb, *.rhtml)\t*.erb;*.rhtml\n" . s:browsefilter
|
|
85
|
-
endif
|
|
86
|
-
|
|
87
|
-
" Load the combined list of match_words for matchit.vim
|
|
88
|
-
if exists("loaded_matchit")
|
|
89
|
-
let b:match_words = s:match_words
|
|
90
|
-
endif
|
|
91
|
-
|
|
92
|
-
" TODO: comments=
|
|
93
|
-
setlocal commentstring=<%#%s%>
|
|
94
|
-
|
|
95
|
-
let b:undo_ftplugin = "setl cms< "
|
|
96
|
-
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
|
|
97
|
-
|
|
98
|
-
let &cpo = s:save_cpo
|
|
99
|
-
|
|
100
|
-
" vim: nowrap sw=2 sts=2 ts=8:
|