utils 0.0.67 → 0.0.68
Sign up to get free protection for your applications and to get access to all the features.
- 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,35 +0,0 @@
|
|
1
|
-
|
2
|
-
" Source the standard indentation file, since we only want to adjust the
|
3
|
-
" default indentation.
|
4
|
-
sou $VIMRUNTIME/indent/html.vim
|
5
|
-
|
6
|
-
" Set the default indentation to be that of the standard indent file.
|
7
|
-
let b:defaultIndentExpr = &indentexpr
|
8
|
-
|
9
|
-
" Use IndentAnything
|
10
|
-
setlocal indentexpr=IndentAnything()
|
11
|
-
|
12
|
-
" Echo info about indentations
|
13
|
-
let b:indent_anything_echo = 1
|
14
|
-
|
15
|
-
"
|
16
|
-
" Adjust the default indentation for comments. Set the comments for html to
|
17
|
-
" look like this:
|
18
|
-
"
|
19
|
-
" <!--
|
20
|
-
" - comment here
|
21
|
-
" -->
|
22
|
-
"
|
23
|
-
setl comments=sr:<!--,m:-,e:-->
|
24
|
-
let b:blockCommentStartRE = '<!--'
|
25
|
-
let b:blockCommentMiddleRE = '-'
|
26
|
-
let b:blockCommentEndRE = '-->'
|
27
|
-
let b:blockCommentMiddleExtra = 3
|
28
|
-
|
29
|
-
" Specify the syntax names for html comments and strings
|
30
|
-
let b:blockCommentRE = 'htmlComment'
|
31
|
-
let b:commentRE = b:blockCommentRE
|
32
|
-
|
33
|
-
let b:stringRE = 'htmlString'
|
34
|
-
let b:singleQuoteStringRE = b:stringRE
|
35
|
-
let b:doubleQuoteStringRE = b:stringRE
|
@@ -1,338 +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_indent")
|
7
|
-
finish
|
8
|
-
endif
|
9
|
-
|
10
|
-
let b:did_indent = 1
|
11
|
-
|
12
|
-
setlocal autoindent
|
13
|
-
setlocal indentexpr=GetCoffeeIndent(v:lnum)
|
14
|
-
" Make sure GetCoffeeIndent is run when these are typed so they can be
|
15
|
-
" indented or outdented.
|
16
|
-
setlocal indentkeys+=0],0),0.,=else,=when,=catch,=finally
|
17
|
-
|
18
|
-
" Only define the function once.
|
19
|
-
if exists("*GetCoffeeIndent")
|
20
|
-
finish
|
21
|
-
endif
|
22
|
-
|
23
|
-
" Keywords to indent after
|
24
|
-
let s:INDENT_AFTER_KEYWORD = '^\%(if\|unless\|else\|for\|while\|until\|'
|
25
|
-
\ . 'loop\|switch\|when\|try\|catch\|finally\|'
|
26
|
-
\ . 'class\)\>'
|
27
|
-
|
28
|
-
" Operators to indent after
|
29
|
-
let s:INDENT_AFTER_OPERATOR = '\%([([{:=]\|[-=]>\)$'
|
30
|
-
|
31
|
-
" Keywords and operators that continue a line
|
32
|
-
let s:CONTINUATION = '\<\%(is\|isnt\|and\|or\)\>$'
|
33
|
-
\ . '\|'
|
34
|
-
\ . '\%(-\@<!-\|+\@<!+\|<\|[-=]\@<!>\|\*\|/\@<!/\|%\||\|'
|
35
|
-
\ . '&\|,\|\.\@<!\.\)$'
|
36
|
-
|
37
|
-
" Operators that block continuation indenting
|
38
|
-
let s:CONTINUATION_BLOCK = '[([{:=]$'
|
39
|
-
|
40
|
-
" A continuation dot access
|
41
|
-
let s:DOT_ACCESS = '^\.'
|
42
|
-
|
43
|
-
" Keywords to outdent after
|
44
|
-
let s:OUTDENT_AFTER = '^\%(return\|break\|continue\|throw\)\>'
|
45
|
-
|
46
|
-
" A compound assignment like `... = if ...`
|
47
|
-
let s:COMPOUND_ASSIGNMENT = '[:=]\s*\%(if\|unless\|for\|while\|until\|'
|
48
|
-
\ . 'switch\|try\|class\)\>'
|
49
|
-
|
50
|
-
" A postfix condition like `return ... if ...`.
|
51
|
-
let s:POSTFIX_CONDITION = '\S\s\+\zs\<\%(if\|unless\)\>'
|
52
|
-
|
53
|
-
" A single-line else statement like `else ...` but not `else if ...
|
54
|
-
let s:SINGLE_LINE_ELSE = '^else\s\+\%(\<\%(if\|unless\)\>\)\@!'
|
55
|
-
|
56
|
-
" Max lines to look back for a match
|
57
|
-
let s:MAX_LOOKBACK = 50
|
58
|
-
|
59
|
-
" Syntax names for strings
|
60
|
-
let s:SYNTAX_STRING = 'coffee\%(String\|AssignString\|Embed\|Regex\|Heregex\|'
|
61
|
-
\ . 'Heredoc\)'
|
62
|
-
|
63
|
-
" Syntax names for comments
|
64
|
-
let s:SYNTAX_COMMENT = 'coffee\%(Comment\|BlockComment\|HeregexComment\)'
|
65
|
-
|
66
|
-
" Syntax names for strings and comments
|
67
|
-
let s:SYNTAX_STRING_COMMENT = s:SYNTAX_STRING . '\|' . s:SYNTAX_COMMENT
|
68
|
-
|
69
|
-
" Get the linked syntax name of a character.
|
70
|
-
function! s:SyntaxName(linenum, col)
|
71
|
-
return synIDattr(synID(a:linenum, a:col, 1), 'name')
|
72
|
-
endfunction
|
73
|
-
|
74
|
-
" Check if a character is in a comment.
|
75
|
-
function! s:IsComment(linenum, col)
|
76
|
-
return s:SyntaxName(a:linenum, a:col) =~ s:SYNTAX_COMMENT
|
77
|
-
endfunction
|
78
|
-
|
79
|
-
" Check if a character is in a string.
|
80
|
-
function! s:IsString(linenum, col)
|
81
|
-
return s:SyntaxName(a:linenum, a:col) =~ s:SYNTAX_STRING
|
82
|
-
endfunction
|
83
|
-
|
84
|
-
" Check if a character is in a comment or string.
|
85
|
-
function! s:IsCommentOrString(linenum, col)
|
86
|
-
return s:SyntaxName(a:linenum, a:col) =~ s:SYNTAX_STRING_COMMENT
|
87
|
-
endfunction
|
88
|
-
|
89
|
-
" Check if a whole line is a comment.
|
90
|
-
function! s:IsCommentLine(linenum)
|
91
|
-
" Check the first non-whitespace character.
|
92
|
-
return s:IsComment(a:linenum, indent(a:linenum) + 1)
|
93
|
-
endfunction
|
94
|
-
|
95
|
-
" Repeatedly search a line for a regex until one is found outside a string or
|
96
|
-
" comment.
|
97
|
-
function! s:SmartSearch(linenum, regex)
|
98
|
-
" Start at the first column.
|
99
|
-
let col = 0
|
100
|
-
|
101
|
-
" Search until there are no more matches, unless a good match is found.
|
102
|
-
while 1
|
103
|
-
call cursor(a:linenum, col + 1)
|
104
|
-
let [_, col] = searchpos(a:regex, 'cn', a:linenum)
|
105
|
-
|
106
|
-
" No more matches.
|
107
|
-
if !col
|
108
|
-
break
|
109
|
-
endif
|
110
|
-
|
111
|
-
if !s:IsCommentOrString(a:linenum, col)
|
112
|
-
return 1
|
113
|
-
endif
|
114
|
-
endwhile
|
115
|
-
|
116
|
-
" No good match found.
|
117
|
-
return 0
|
118
|
-
endfunction
|
119
|
-
|
120
|
-
" Skip a match if it's in a comment or string, is a single-line statement that
|
121
|
-
" isn't adjacent, or is a postfix condition.
|
122
|
-
function! s:ShouldSkip(startlinenum, linenum, col)
|
123
|
-
if s:IsCommentOrString(a:linenum, a:col)
|
124
|
-
return 1
|
125
|
-
endif
|
126
|
-
|
127
|
-
" Check for a single-line statement that isn't adjacent.
|
128
|
-
if s:SmartSearch(a:linenum, '\<then\>') && a:startlinenum - a:linenum > 1
|
129
|
-
return 1
|
130
|
-
endif
|
131
|
-
|
132
|
-
if s:SmartSearch(a:linenum, s:POSTFIX_CONDITION) &&
|
133
|
-
\ !s:SmartSearch(a:linenum, s:COMPOUND_ASSIGNMENT)
|
134
|
-
return 1
|
135
|
-
endif
|
136
|
-
|
137
|
-
return 0
|
138
|
-
endfunction
|
139
|
-
|
140
|
-
" Find the farthest line to look back to, capped to line 1 (zero and negative
|
141
|
-
" numbers cause bad things).
|
142
|
-
function! s:MaxLookback(startlinenum)
|
143
|
-
return max([1, a:startlinenum - s:MAX_LOOKBACK])
|
144
|
-
endfunction
|
145
|
-
|
146
|
-
" Get the skip expression for searchpair().
|
147
|
-
function! s:SkipExpr(startlinenum)
|
148
|
-
return "s:ShouldSkip(" . a:startlinenum . ", line('.'), col('.'))"
|
149
|
-
endfunction
|
150
|
-
|
151
|
-
" Search for pairs of text.
|
152
|
-
function! s:SearchPair(start, end)
|
153
|
-
" The cursor must be in the first column for regexes to match.
|
154
|
-
call cursor(0, 1)
|
155
|
-
|
156
|
-
let startlinenum = line('.')
|
157
|
-
|
158
|
-
" Don't need the W flag since MaxLookback caps the search to line 1.
|
159
|
-
return searchpair(a:start, '', a:end, 'bcn',
|
160
|
-
\ s:SkipExpr(startlinenum),
|
161
|
-
\ s:MaxLookback(startlinenum))
|
162
|
-
endfunction
|
163
|
-
|
164
|
-
" Try to find a previous matching line.
|
165
|
-
function! s:GetMatch(curline)
|
166
|
-
let firstchar = a:curline[0]
|
167
|
-
|
168
|
-
if firstchar == '}'
|
169
|
-
return s:SearchPair('{', '}')
|
170
|
-
elseif firstchar == ')'
|
171
|
-
return s:SearchPair('(', ')')
|
172
|
-
elseif firstchar == ']'
|
173
|
-
return s:SearchPair('\[', '\]')
|
174
|
-
elseif a:curline =~ '^else\>'
|
175
|
-
return s:SearchPair('\<\%(if\|unless\|when\)\>', '\<else\>')
|
176
|
-
elseif a:curline =~ '^catch\>'
|
177
|
-
return s:SearchPair('\<try\>', '\<catch\>')
|
178
|
-
elseif a:curline =~ '^finally\>'
|
179
|
-
return s:SearchPair('\<try\>', '\<finally\>')
|
180
|
-
endif
|
181
|
-
|
182
|
-
return 0
|
183
|
-
endfunction
|
184
|
-
|
185
|
-
" Get the nearest previous line that isn't a comment.
|
186
|
-
function! s:GetPrevNormalLine(startlinenum)
|
187
|
-
let curlinenum = a:startlinenum
|
188
|
-
|
189
|
-
while curlinenum > 0
|
190
|
-
let curlinenum = prevnonblank(curlinenum - 1)
|
191
|
-
|
192
|
-
if !s:IsCommentLine(curlinenum)
|
193
|
-
return curlinenum
|
194
|
-
endif
|
195
|
-
endwhile
|
196
|
-
|
197
|
-
return 0
|
198
|
-
endfunction
|
199
|
-
|
200
|
-
" Try to find a comment in a line.
|
201
|
-
function! s:FindComment(linenum)
|
202
|
-
let col = 0
|
203
|
-
|
204
|
-
while 1
|
205
|
-
call cursor(a:linenum, col + 1)
|
206
|
-
let [_, col] = searchpos('#', 'cn', a:linenum)
|
207
|
-
|
208
|
-
if !col
|
209
|
-
break
|
210
|
-
endif
|
211
|
-
|
212
|
-
if s:IsComment(a:linenum, col)
|
213
|
-
return col
|
214
|
-
endif
|
215
|
-
endwhile
|
216
|
-
|
217
|
-
return 0
|
218
|
-
endfunction
|
219
|
-
|
220
|
-
" Get a line without comments or surrounding whitespace.
|
221
|
-
function! s:GetTrimmedLine(linenum)
|
222
|
-
let comment = s:FindComment(a:linenum)
|
223
|
-
let line = getline(a:linenum)
|
224
|
-
|
225
|
-
if comment
|
226
|
-
" Subtract 1 to get to the column before the comment and another 1 for
|
227
|
-
" zero-based indexing.
|
228
|
-
let line = line[:comment - 2]
|
229
|
-
endif
|
230
|
-
|
231
|
-
return substitute(substitute(line, '^\s\+', '', ''),
|
232
|
-
\ '\s\+$', '', '')
|
233
|
-
endfunction
|
234
|
-
|
235
|
-
function! s:GetCoffeeIndent(curlinenum)
|
236
|
-
let prevlinenum = s:GetPrevNormalLine(a:curlinenum)
|
237
|
-
|
238
|
-
" Don't do anything if there's no previous line.
|
239
|
-
if !prevlinenum
|
240
|
-
return -1
|
241
|
-
endif
|
242
|
-
|
243
|
-
let curline = s:GetTrimmedLine(a:curlinenum)
|
244
|
-
|
245
|
-
" Try to find a previous matching statement. This handles outdenting.
|
246
|
-
let matchlinenum = s:GetMatch(curline)
|
247
|
-
|
248
|
-
if matchlinenum
|
249
|
-
return indent(matchlinenum)
|
250
|
-
endif
|
251
|
-
|
252
|
-
" Try to find a matching `when`.
|
253
|
-
if curline =~ '^when\>' && !s:SmartSearch(prevlinenum, '\<switch\>')
|
254
|
-
let linenum = a:curlinenum
|
255
|
-
|
256
|
-
while linenum > 0
|
257
|
-
let linenum = s:GetPrevNormalLine(linenum)
|
258
|
-
|
259
|
-
if getline(linenum) =~ '^\s*when\>'
|
260
|
-
return indent(linenum)
|
261
|
-
endif
|
262
|
-
endwhile
|
263
|
-
|
264
|
-
return -1
|
265
|
-
endif
|
266
|
-
|
267
|
-
let prevline = s:GetTrimmedLine(prevlinenum)
|
268
|
-
let previndent = indent(prevlinenum)
|
269
|
-
|
270
|
-
" Always indent after these operators.
|
271
|
-
if prevline =~ s:INDENT_AFTER_OPERATOR
|
272
|
-
return previndent + &shiftwidth
|
273
|
-
endif
|
274
|
-
|
275
|
-
" Indent after a continuation if it's the first.
|
276
|
-
if prevline =~ s:CONTINUATION
|
277
|
-
" If the line ends in a slash, make sure it isn't a regex.
|
278
|
-
if prevline =~ '/$'
|
279
|
-
" Move to the line so we can get the last column.
|
280
|
-
call cursor(prevlinenum)
|
281
|
-
|
282
|
-
if s:IsString(prevlinenum, col('$') - 1)
|
283
|
-
return -1
|
284
|
-
endif
|
285
|
-
endif
|
286
|
-
|
287
|
-
let prevprevlinenum = s:GetPrevNormalLine(prevlinenum)
|
288
|
-
|
289
|
-
" If the continuation is the first in the file, don't run the other checks.
|
290
|
-
if !prevprevlinenum
|
291
|
-
return previndent + &shiftwidth
|
292
|
-
endif
|
293
|
-
|
294
|
-
let prevprevline = s:GetTrimmedLine(prevprevlinenum)
|
295
|
-
|
296
|
-
if prevprevline !~ s:CONTINUATION && prevprevline !~ s:CONTINUATION_BLOCK
|
297
|
-
return previndent + &shiftwidth
|
298
|
-
endif
|
299
|
-
|
300
|
-
return -1
|
301
|
-
endif
|
302
|
-
|
303
|
-
" Indent after these keywords and compound assignments if they aren't a
|
304
|
-
" single-line statement.
|
305
|
-
if prevline =~ s:INDENT_AFTER_KEYWORD || prevline =~ s:COMPOUND_ASSIGNMENT
|
306
|
-
if !s:SmartSearch(prevlinenum, '\<then\>') && prevline !~ s:SINGLE_LINE_ELSE
|
307
|
-
return previndent + &shiftwidth
|
308
|
-
endif
|
309
|
-
|
310
|
-
return -1
|
311
|
-
endif
|
312
|
-
|
313
|
-
" Indent a dot access if it's the first.
|
314
|
-
if curline =~ s:DOT_ACCESS && prevline !~ s:DOT_ACCESS
|
315
|
-
return previndent + &shiftwidth
|
316
|
-
endif
|
317
|
-
|
318
|
-
" Outdent after these keywords if they don't have a postfix condition or are
|
319
|
-
" a single-line statement.
|
320
|
-
if prevline =~ s:OUTDENT_AFTER
|
321
|
-
if !s:SmartSearch(prevlinenum, s:POSTFIX_CONDITION) ||
|
322
|
-
\ s:SmartSearch(prevlinenum, '\<then\>')
|
323
|
-
return previndent - &shiftwidth
|
324
|
-
endif
|
325
|
-
endif
|
326
|
-
|
327
|
-
" No indenting or outdenting is needed.
|
328
|
-
return -1
|
329
|
-
endfunction
|
330
|
-
|
331
|
-
" Wrap s:GetCoffeeIndent to keep the cursor position.
|
332
|
-
function! GetCoffeeIndent(curlinenum)
|
333
|
-
let oldcursor = getpos('.')
|
334
|
-
let indent = s:GetCoffeeIndent(a:curlinenum)
|
335
|
-
call setpos('.', oldcursor)
|
336
|
-
|
337
|
-
return indent
|
338
|
-
endfunction
|
@@ -1,77 +0,0 @@
|
|
1
|
-
" Vim indent file
|
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
|
-
if exists("b:did_indent")
|
9
|
-
finish
|
10
|
-
endif
|
11
|
-
|
12
|
-
runtime! indent/ruby.vim
|
13
|
-
unlet! b:did_indent
|
14
|
-
setlocal indentexpr=
|
15
|
-
|
16
|
-
if exists("b:eruby_subtype")
|
17
|
-
exe "runtime! indent/".b:eruby_subtype.".vim"
|
18
|
-
else
|
19
|
-
runtime! indent/html.vim
|
20
|
-
endif
|
21
|
-
unlet! b:did_indent
|
22
|
-
|
23
|
-
if &l:indentexpr == ''
|
24
|
-
if &l:cindent
|
25
|
-
let &l:indentexpr = 'cindent(v:lnum)'
|
26
|
-
else
|
27
|
-
let &l:indentexpr = 'indent(prevnonblank(v:lnum-1))'
|
28
|
-
endif
|
29
|
-
endif
|
30
|
-
let b:eruby_subtype_indentexpr = &l:indentexpr
|
31
|
-
|
32
|
-
let b:did_indent = 1
|
33
|
-
|
34
|
-
setlocal indentexpr=GetErubyIndent()
|
35
|
-
setlocal indentkeys=o,O,*<Return>,<>>,{,},0),0],o,O,!^F,=end,=else,=elsif,=rescue,=ensure,=when
|
36
|
-
|
37
|
-
" Only define the function once.
|
38
|
-
if exists("*GetErubyIndent")
|
39
|
-
finish
|
40
|
-
endif
|
41
|
-
|
42
|
-
function! GetErubyIndent(...)
|
43
|
-
if a:0 && a:1 == '.'
|
44
|
-
let v:lnum = line('.')
|
45
|
-
elseif a:0 && a:1 =~ '^\d'
|
46
|
-
let v:lnum = a:1
|
47
|
-
endif
|
48
|
-
let vcol = col('.')
|
49
|
-
call cursor(v:lnum,1)
|
50
|
-
let inruby = searchpair('<%','','%>','W')
|
51
|
-
call cursor(v:lnum,vcol)
|
52
|
-
if inruby && getline(v:lnum) !~ '^<%\|^\s*-\=%>'
|
53
|
-
let ind = GetRubyIndent()
|
54
|
-
else
|
55
|
-
exe "let ind = ".b:eruby_subtype_indentexpr
|
56
|
-
endif
|
57
|
-
let lnum = prevnonblank(v:lnum-1)
|
58
|
-
let line = getline(lnum)
|
59
|
-
let cline = getline(v:lnum)
|
60
|
-
if cline =~# '<%-\=\s*\%(}\|end\|else\|\%(ensure\|rescue\|elsif\|when\).\{-\}\)\s*\%(-\=%>\|$\)'
|
61
|
-
let ind = ind - &sw
|
62
|
-
endif
|
63
|
-
if line =~# '\%({\|\<do\)\%(\s*|[^|]*|\)\=\s*-\=%>'
|
64
|
-
let ind = ind + &sw
|
65
|
-
elseif line =~# '<%-\=\s*\%(module\|class\|def\|if\|for\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\)\>.*%>'
|
66
|
-
let ind = ind + &sw
|
67
|
-
endif
|
68
|
-
if line =~# '^\s*<%[=#-]\=\s*$' && cline !~# '^\s*end\>'
|
69
|
-
let ind = ind + &sw
|
70
|
-
endif
|
71
|
-
if cline =~# '^\s*-\=%>\s*$'
|
72
|
-
let ind = ind - &sw
|
73
|
-
endif
|
74
|
-
return ind
|
75
|
-
endfunction
|
76
|
-
|
77
|
-
" vim:set sw=2 sts=2 ts=8 noet:
|
@@ -1,116 +0,0 @@
|
|
1
|
-
"
|
2
|
-
" Copyright 2006 Tye Zdrojewski
|
3
|
-
"
|
4
|
-
" Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
5
|
-
" use this file except in compliance with the License. You may obtain a copy of
|
6
|
-
" the License at
|
7
|
-
"
|
8
|
-
" http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
"
|
10
|
-
" Unless required by applicable law or agreed to in writing, software distributed
|
11
|
-
" under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
12
|
-
" CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
13
|
-
" specific language governing permissions and limitations under the License.
|
14
|
-
"
|
15
|
-
"
|
16
|
-
"
|
17
|
-
" Script:
|
18
|
-
"
|
19
|
-
" Javascript Indentation
|
20
|
-
"
|
21
|
-
" Version: 1.1.2
|
22
|
-
"
|
23
|
-
" Description:
|
24
|
-
"
|
25
|
-
" Indentation for Javascript. This script uses the IndentAnything plugin.
|
26
|
-
"
|
27
|
-
"
|
28
|
-
" Installation:
|
29
|
-
"
|
30
|
-
" Place this file in your home directory under ~/.vim/indent/, or replace
|
31
|
-
" the system indent/javascript.vim file to affect all users.
|
32
|
-
"
|
33
|
-
" Maintainer: Tye Z. <zdro@yahoo.com>
|
34
|
-
"
|
35
|
-
"
|
36
|
-
" History:
|
37
|
-
"
|
38
|
-
" 1.1.1 - Added license
|
39
|
-
" 1.1.2 - Added indentation for [...] pairs
|
40
|
-
" 1.1.3 - Fixed silly syntax error
|
41
|
-
"
|
42
|
-
"
|
43
|
-
|
44
|
-
let IndentAnything_Dbg = 0
|
45
|
-
let IndentAnything_Dbg = 1
|
46
|
-
|
47
|
-
" Only load this indent file when no other was loaded.
|
48
|
-
if exists("b:did_indent") && ! IndentAnything_Dbg
|
49
|
-
finish
|
50
|
-
endif
|
51
|
-
|
52
|
-
let b:did_indent = 1
|
53
|
-
|
54
|
-
setlocal indentexpr=IndentAnything()
|
55
|
-
setlocal indentkeys+=0),0},),;
|
56
|
-
|
57
|
-
" Only define the function once.
|
58
|
-
if exists("*IndentAnything") && ! IndentAnything_Dbg
|
59
|
-
finish
|
60
|
-
endif
|
61
|
-
|
62
|
-
setlocal indentexpr=IndentAnything()
|
63
|
-
|
64
|
-
""" BEGIN IndentAnything specification
|
65
|
-
|
66
|
-
"
|
67
|
-
" Syntax name REs for comments and strings.
|
68
|
-
"
|
69
|
-
let b:commentRE = 'javaScript\(Line\)\?Comment'
|
70
|
-
let b:lineCommentRE = 'javaScriptLineComment'
|
71
|
-
let b:blockCommentRE = 'javaScriptComment'
|
72
|
-
let b:stringRE = 'javaScriptString\(S\|D\)'
|
73
|
-
let b:singleQuoteStringRE = 'javaScriptStringS'
|
74
|
-
let b:doubleQuoteStringRE = 'javaScriptStringD'
|
75
|
-
|
76
|
-
|
77
|
-
"
|
78
|
-
" Setup for C-style comment indentation.
|
79
|
-
"
|
80
|
-
let b:blockCommentStartRE = '/\*'
|
81
|
-
let b:blockCommentMiddleRE = '\*'
|
82
|
-
let b:blockCommentEndRE = '\*/'
|
83
|
-
let b:blockCommentMiddleExtra = 1
|
84
|
-
|
85
|
-
"
|
86
|
-
" Indent another level for each non-closed paren/'(' , bracket/'[', and
|
87
|
-
" brace/'{' on the previous line.
|
88
|
-
|
89
|
-
let b:indentTrios = [
|
90
|
-
\ [ '(', '', ')' ],
|
91
|
-
\ [ '{', '\(default:\|case.*:\)', '}' ],
|
92
|
-
\ [ '\[', '', '\]' ]
|
93
|
-
\]
|
94
|
-
|
95
|
-
|
96
|
-
"
|
97
|
-
" Line continuations. Lines that are continued on the next line are
|
98
|
-
" if/for/while statements that are NOT followed by a '{' block and operators
|
99
|
-
" at the end of a line.
|
100
|
-
"
|
101
|
-
let b:lineContList = [
|
102
|
-
\ { 'pattern' : '^\s*\(if\|for\|while\)\s*(.*)\s*\(\(//.*\)\|/\*.*\*/\s*\)\?\_$\(\_s*{\)\@!' },
|
103
|
-
\ { 'pattern' : '^\s*else' . '\s*\(\(//.*\)\|/\*.*\*/\s*\)\?\_$\(\_s*{\)\@!' },
|
104
|
-
\ { 'pattern' : '\(+\|=\|+=\|-=\)\s*\(\(//.*\)\|/\*.*\*/\s*\)\?$' }
|
105
|
-
\]
|
106
|
-
|
107
|
-
"
|
108
|
-
" If a continued line and its continuation can have line-comments between
|
109
|
-
" them, then this should be true. For example,
|
110
|
-
"
|
111
|
-
" if (x)
|
112
|
-
" // comment here
|
113
|
-
" statement
|
114
|
-
"
|
115
|
-
let b:contTraversesLineComments = 1
|
116
|
-
|